@apimatic/cli 1.1.0-alpha.21 → 1.1.0-alpha.22
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 +112 -90
- package/lib/actions/action-result.d.ts +8 -3
- package/lib/actions/action-result.js +34 -15
- package/lib/actions/action-result.js.map +1 -1
- package/lib/actions/api/transform.d.ts +15 -0
- package/lib/actions/api/transform.js +48 -0
- package/lib/actions/api/transform.js.map +1 -0
- package/lib/actions/api/validate.d.ts +12 -0
- package/lib/actions/api/validate.js +41 -0
- package/lib/actions/api/validate.js.map +1 -0
- package/lib/actions/auth/login.d.ts +6 -5
- package/lib/actions/auth/login.js +25 -33
- package/lib/actions/auth/login.js.map +1 -1
- package/lib/actions/auth/logout.d.ts +8 -0
- package/lib/actions/auth/logout.js +15 -0
- package/lib/actions/auth/logout.js.map +1 -0
- package/lib/actions/auth/status.d.ts +11 -0
- package/lib/actions/auth/status.js +26 -0
- package/lib/actions/auth/status.js.map +1 -0
- package/lib/actions/portal/copilot.d.ts +5 -3
- package/lib/actions/portal/copilot.js +47 -37
- package/lib/actions/portal/copilot.js.map +1 -1
- package/lib/actions/portal/generate.d.ts +4 -5
- package/lib/actions/portal/generate.js +30 -37
- package/lib/actions/portal/generate.js.map +1 -1
- package/lib/actions/portal/quickstart.d.ts +16 -0
- package/lib/actions/portal/quickstart.js +145 -0
- package/lib/actions/portal/quickstart.js.map +1 -0
- package/lib/actions/portal/recipe/new-recipe.d.ts +11 -20
- package/lib/actions/portal/recipe/new-recipe.js +147 -221
- package/lib/actions/portal/recipe/new-recipe.js.map +1 -1
- package/lib/actions/portal/serve.d.ts +12 -10
- package/lib/actions/portal/serve.js +112 -17
- package/lib/actions/portal/serve.js.map +1 -1
- package/lib/actions/portal/toc/new-toc.d.ts +16 -15
- package/lib/actions/portal/toc/new-toc.js +80 -116
- package/lib/actions/portal/toc/new-toc.js.map +1 -1
- package/lib/actions/sdk/generate.d.ts +5 -6
- package/lib/actions/sdk/generate.js +22 -47
- package/lib/actions/sdk/generate.js.map +1 -1
- package/lib/application/portal/recipe/portal-recipe.d.ts +2 -2
- package/lib/application/portal/recipe/portal-recipe.js +9 -9
- package/lib/application/portal/recipe/portal-recipe.js.map +1 -1
- package/lib/application/portal/recipe/recipe-generator.d.ts +7 -2
- package/lib/application/portal/recipe/recipe-generator.js +21 -22
- package/lib/application/portal/recipe/recipe-generator.js.map +1 -1
- package/lib/client-utils/auth-manager.d.ts +1 -1
- package/lib/client-utils/auth-manager.js +3 -4
- package/lib/client-utils/auth-manager.js.map +1 -1
- package/lib/commands/api/transform.d.ts +6 -3
- package/lib/commands/api/transform.js +43 -94
- package/lib/commands/api/transform.js.map +1 -1
- package/lib/commands/api/validate.d.ts +6 -3
- package/lib/commands/api/validate.js +27 -66
- package/lib/commands/api/validate.js.map +1 -1
- package/lib/commands/auth/login.d.ts +2 -1
- package/lib/commands/auth/login.js +15 -9
- package/lib/commands/auth/login.js.map +1 -1
- package/lib/commands/auth/logout.d.ts +3 -1
- package/lib/commands/auth/logout.js +12 -13
- package/lib/commands/auth/logout.js.map +1 -1
- package/lib/commands/auth/status.d.ts +1 -0
- package/lib/commands/auth/status.js +13 -11
- package/lib/commands/auth/status.js.map +1 -1
- package/lib/commands/portal/copilot.d.ts +2 -2
- package/lib/commands/portal/copilot.js +22 -20
- package/lib/commands/portal/copilot.js.map +1 -1
- package/lib/commands/portal/generate.d.ts +3 -4
- package/lib/commands/portal/generate.js +19 -14
- package/lib/commands/portal/generate.js.map +1 -1
- package/lib/commands/portal/quickstart.d.ts +3 -4
- package/lib/commands/portal/quickstart.js +24 -101
- package/lib/commands/portal/quickstart.js.map +1 -1
- package/lib/commands/portal/recipe/new.d.ts +3 -1
- package/lib/commands/portal/recipe/new.js +31 -23
- package/lib/commands/portal/recipe/new.js.map +1 -1
- package/lib/commands/portal/serve.d.ts +5 -5
- package/lib/commands/portal/serve.js +31 -57
- package/lib/commands/portal/serve.js.map +1 -1
- package/lib/commands/portal/toc/new.d.ts +2 -2
- package/lib/commands/portal/toc/new.js +35 -26
- package/lib/commands/portal/toc/new.js.map +1 -1
- package/lib/commands/sdk/generate.d.ts +5 -4
- package/lib/commands/sdk/generate.js +26 -17
- package/lib/commands/sdk/generate.js.map +1 -1
- package/lib/hooks/not-found.js +1 -1
- package/lib/hooks/not-found.js.map +1 -1
- package/lib/infrastructure/api-utils.js +3 -2
- package/lib/infrastructure/api-utils.js.map +1 -1
- package/lib/{application/portal/serve/watcher-handler.d.ts → infrastructure/debounce-service.d.ts} +3 -3
- package/lib/{application/portal/serve/watcher-handler.js → infrastructure/debounce-service.js} +5 -4
- package/lib/infrastructure/debounce-service.js.map +1 -0
- package/lib/infrastructure/env-info.d.ts +1 -1
- package/lib/infrastructure/env-info.js +2 -2
- package/lib/infrastructure/env-info.js.map +1 -1
- package/lib/infrastructure/file-service.d.ts +7 -2
- package/lib/infrastructure/file-service.js +46 -5
- package/lib/infrastructure/file-service.js.map +1 -1
- package/lib/infrastructure/launcher-service.d.ts +2 -0
- package/lib/infrastructure/launcher-service.js +4 -0
- package/lib/infrastructure/launcher-service.js.map +1 -1
- package/lib/infrastructure/network-service.d.ts +3 -0
- package/lib/infrastructure/network-service.js +7 -0
- package/lib/infrastructure/network-service.js.map +1 -0
- package/lib/infrastructure/services/api-client-factory.d.ts +6 -0
- package/lib/infrastructure/services/api-client-factory.js +20 -0
- package/lib/infrastructure/services/api-client-factory.js.map +1 -0
- package/lib/infrastructure/services/api-service.d.ts +2 -2
- package/lib/infrastructure/services/api-service.js +6 -6
- package/lib/infrastructure/services/api-service.js.map +1 -1
- package/lib/infrastructure/services/auth-service.d.ts +1 -1
- package/lib/infrastructure/services/auth-service.js +7 -5
- package/lib/infrastructure/services/auth-service.js.map +1 -1
- package/lib/infrastructure/services/file-download-service.d.ts +15 -0
- package/lib/infrastructure/services/file-download-service.js +104 -0
- package/lib/infrastructure/services/file-download-service.js.map +1 -0
- package/lib/infrastructure/services/portal-service.d.ts +11 -13
- package/lib/infrastructure/services/portal-service.js +73 -102
- package/lib/infrastructure/services/portal-service.js.map +1 -1
- package/lib/infrastructure/services/telemetry-service.d.ts +3 -2
- package/lib/infrastructure/services/telemetry-service.js +4 -6
- package/lib/infrastructure/services/telemetry-service.js.map +1 -1
- package/lib/infrastructure/services/transformation-service.d.ts +23 -0
- package/lib/infrastructure/services/transformation-service.js +56 -0
- package/lib/infrastructure/services/transformation-service.js.map +1 -0
- package/lib/infrastructure/services/validation-service.d.ts +17 -0
- package/lib/infrastructure/services/validation-service.js +49 -0
- package/lib/infrastructure/services/validation-service.js.map +1 -0
- package/lib/prompts/api/transform.d.ts +11 -0
- package/lib/prompts/api/transform.js +30 -0
- package/lib/prompts/api/transform.js.map +1 -0
- package/lib/prompts/api/validate.d.ts +12 -0
- package/lib/prompts/api/validate.js +41 -0
- package/lib/prompts/api/validate.js.map +1 -0
- package/lib/prompts/auth/login.d.ts +6 -1
- package/lib/prompts/auth/login.js +12 -3
- package/lib/prompts/auth/login.js.map +1 -1
- package/lib/prompts/auth/logout.d.ts +3 -0
- package/lib/prompts/auth/logout.js +7 -0
- package/lib/prompts/auth/logout.js.map +1 -0
- package/lib/prompts/auth/status.d.ts +8 -0
- package/lib/prompts/auth/status.js +21 -0
- package/lib/prompts/auth/status.js.map +1 -0
- package/lib/prompts/format.d.ts +33 -0
- package/lib/prompts/format.js +99 -0
- package/lib/prompts/format.js.map +1 -0
- package/lib/prompts/portal/copilot.d.ts +8 -4
- package/lib/prompts/portal/copilot.js +35 -24
- package/lib/prompts/portal/copilot.js.map +1 -1
- package/lib/prompts/portal/generate.d.ts +9 -7
- package/lib/prompts/portal/generate.js +22 -23
- package/lib/prompts/portal/generate.js.map +1 -1
- package/lib/prompts/portal/quickstart.d.ts +30 -29
- package/lib/prompts/portal/quickstart.js +99 -193
- package/lib/prompts/portal/quickstart.js.map +1 -1
- package/lib/prompts/portal/recipe/new-recipe.d.ts +23 -18
- package/lib/prompts/portal/recipe/new-recipe.js +70 -108
- package/lib/prompts/portal/recipe/new-recipe.js.map +1 -1
- package/lib/prompts/portal/serve.d.ts +10 -3
- package/lib/prompts/portal/serve.js +30 -11
- package/lib/prompts/portal/serve.js.map +1 -1
- package/lib/prompts/portal/toc/new-toc.d.ts +12 -8
- package/lib/prompts/portal/toc/new-toc.js +20 -22
- package/lib/prompts/portal/toc/new-toc.js.map +1 -1
- package/lib/prompts/sdk/generate.d.ts +7 -7
- package/lib/prompts/sdk/generate.js +17 -23
- package/lib/prompts/sdk/generate.js.map +1 -1
- package/lib/types/api/account.d.ts +1 -1
- package/lib/types/api/transform.d.ts +14 -25
- package/lib/types/api/transform.js +16 -16
- package/lib/types/api/transform.js.map +1 -1
- package/lib/types/build/build.d.ts +9 -1
- package/lib/types/build/build.js +5 -2
- package/lib/types/build/build.js.map +1 -1
- package/lib/types/build-context.d.ts +5 -1
- package/lib/types/build-context.js +21 -4
- package/lib/types/build-context.js.map +1 -1
- package/lib/types/common/command-metadata.d.ts +4 -0
- package/lib/types/common/command-metadata.js +2 -0
- package/lib/types/common/command-metadata.js.map +1 -0
- package/lib/types/events/domain-event.d.ts +1 -1
- package/lib/types/events/domain-event.js.map +1 -1
- package/lib/types/events/quickstart-completed.js +1 -1
- package/lib/types/events/quickstart-initiated.js +1 -1
- package/lib/types/events/recipe-creation-failed.d.ts +1 -1
- package/lib/types/events/recipe-creation-failed.js +1 -1
- package/lib/types/events/recipe-creation-failed.js.map +1 -1
- package/lib/types/events/toc-creation-failed.d.ts +1 -1
- package/lib/types/events/toc-creation-failed.js +1 -1
- package/lib/types/events/toc-creation-failed.js.map +1 -1
- package/lib/types/file/directory.d.ts +17 -0
- package/lib/types/file/directory.js +86 -0
- package/lib/types/file/directory.js.map +1 -0
- package/lib/types/file/directoryPath.d.ts +3 -1
- package/lib/types/file/directoryPath.js +8 -2
- package/lib/types/file/directoryPath.js.map +1 -1
- package/lib/types/file/fileName.d.ts +2 -0
- package/lib/types/file/fileName.js +12 -0
- package/lib/types/file/fileName.js.map +1 -1
- package/lib/types/file/filePath.d.ts +2 -0
- package/lib/types/file/filePath.js +21 -0
- package/lib/types/file/filePath.js.map +1 -1
- package/lib/types/file/resource-input.d.ts +5 -0
- package/lib/types/file/resource-input.js +42 -0
- package/lib/types/file/resource-input.js.map +1 -0
- package/lib/types/file/urlPath.d.ts +6 -0
- package/lib/types/file/urlPath.js +22 -0
- package/lib/types/file/urlPath.js.map +1 -0
- package/lib/types/portal-context.d.ts +3 -1
- package/lib/types/portal-context.js +10 -0
- package/lib/types/portal-context.js.map +1 -1
- package/lib/types/recipe/recipe.d.ts +2 -17
- package/lib/types/recipe-context.d.ts +8 -0
- package/lib/types/recipe-context.js +21 -0
- package/lib/types/recipe-context.js.map +1 -0
- package/lib/types/resource-context.d.ts +12 -0
- package/lib/types/resource-context.js +30 -0
- package/lib/types/resource-context.js.map +1 -0
- package/lib/types/sdk/generate.d.ts +2 -15
- package/lib/types/sdk/generate.js +24 -10
- package/lib/types/sdk/generate.js.map +1 -1
- package/lib/types/sdk-context.d.ts +6 -5
- package/lib/types/sdk-context.js +12 -8
- package/lib/types/sdk-context.js.map +1 -1
- package/lib/types/sdl/sdl.d.ts +9 -0
- package/lib/types/sdl/sdl.js +46 -1
- package/lib/types/sdl/sdl.js.map +1 -1
- package/lib/types/spec-context.d.ts +3 -0
- package/lib/types/spec-context.js +7 -2
- package/lib/types/spec-context.js.map +1 -1
- package/lib/types/temp-context.d.ts +11 -0
- package/lib/types/temp-context.js +27 -0
- package/lib/types/temp-context.js.map +1 -0
- package/lib/types/toc-context.d.ts +12 -0
- package/lib/types/toc-context.js +26 -0
- package/lib/types/toc-context.js.map +1 -0
- package/lib/types/transform-context.d.ts +13 -0
- package/lib/types/transform-context.js +30 -0
- package/lib/types/transform-context.js.map +1 -0
- package/lib/types/utils.d.ts +0 -9
- package/lib/utils/string-utils.d.ts +1 -0
- package/lib/utils/string-utils.js +10 -0
- package/lib/utils/string-utils.js.map +1 -0
- package/lib/utils/utils.d.ts +2 -27
- package/lib/utils/utils.js +6 -145
- package/lib/utils/utils.js.map +1 -1
- package/package.json +4 -4
- package/lib/application/portal/serve/portal-watcher.d.ts +0 -11
- package/lib/application/portal/serve/portal-watcher.js +0 -64
- package/lib/application/portal/serve/portal-watcher.js.map +0 -1
- package/lib/application/portal/serve/serve-handler.d.ts +0 -16
- package/lib/application/portal/serve/serve-handler.js +0 -91
- package/lib/application/portal/serve/serve-handler.js.map +0 -1
- package/lib/application/portal/serve/watcher-handler.js.map +0 -1
- package/lib/application/portal/toc/sdl-parser.d.ts +0 -19
- package/lib/application/portal/toc/sdl-parser.js +0 -90
- package/lib/application/portal/toc/sdl-parser.js.map +0 -1
- package/lib/client-utils/sdk-client.d.ts +0 -18
- package/lib/client-utils/sdk-client.js +0 -41
- package/lib/client-utils/sdk-client.js.map +0 -1
- package/lib/config/env.d.ts +0 -26
- package/lib/config/env.js +0 -27
- package/lib/config/env.js.map +0 -1
- package/lib/controllers/api/transform.d.ts +0 -5
- package/lib/controllers/api/transform.js +0 -50
- package/lib/controllers/api/transform.js.map +0 -1
- package/lib/controllers/api/validate.d.ts +0 -3
- package/lib/controllers/api/validate.js +0 -29
- package/lib/controllers/api/validate.js.map +0 -1
- package/lib/controllers/portal/quickstart.d.ts +0 -13
- package/lib/controllers/portal/quickstart.js +0 -214
- package/lib/controllers/portal/quickstart.js.map +0 -1
- package/lib/infrastructure/api-client-utils.d.ts +0 -6
- package/lib/infrastructure/api-client-utils.js +0 -34
- package/lib/infrastructure/api-client-utils.js.map +0 -1
- package/lib/prompts/portal/common/base-prompts.d.ts +0 -7
- package/lib/prompts/portal/common/base-prompts.js +0 -19
- package/lib/prompts/portal/common/base-prompts.js.map +0 -1
- package/lib/types/api/validate.d.ts +0 -12
- package/lib/types/api/validate.js +0 -2
- package/lib/types/api/validate.js.map +0 -1
- package/lib/types/common/result.d.ts +0 -17
- package/lib/types/common/result.js +0 -32
- package/lib/types/common/result.js.map +0 -1
- package/lib/types/portal/generate.d.ts +0 -13
- package/lib/types/portal/generate.js +0 -3
- package/lib/types/portal/generate.js.map +0 -1
- package/lib/types/portal/quickstart.d.ts +0 -17
- package/lib/types/portal/quickstart.js +0 -2
- package/lib/types/portal/quickstart.js.map +0 -1
- package/lib/types/portal/serve.d.ts +0 -12
- package/lib/types/portal/serve.js +0 -2
- package/lib/types/portal/serve.js.map +0 -1
- package/lib/validators/common/directoryValidator.d.ts +0 -5
- package/lib/validators/common/directoryValidator.js +0 -22
- package/lib/validators/common/directoryValidator.js.map +0 -1
- package/lib/validators/portal/serve-validator.d.ts +0 -6
- package/lib/validators/portal/serve-validator.js +0 -15
- package/lib/validators/portal/serve-validator.js.map +0 -1
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
import { PortalServePrompts } from "../../prompts/portal/serve.js";
|
|
2
|
-
import { ServeFlags, ServePaths } from "../../types/portal/serve.js";
|
|
3
|
-
import { ServeHandler } from "../../application/portal/serve/serve-handler.js";
|
|
4
|
-
import { Result } from "../../types/common/result.js";
|
|
5
|
-
import { PortalService } from "../../infrastructure/services/portal-service.js";
|
|
6
1
|
import { DirectoryPath } from "../../types/file/directoryPath.js";
|
|
7
2
|
import { ActionResult } from "../action-result.js";
|
|
3
|
+
import { CommandMetadata } from "../../types/common/command-metadata.js";
|
|
8
4
|
export declare class PortalServeAction {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
5
|
+
private readonly prompts;
|
|
6
|
+
private readonly networkService;
|
|
7
|
+
private readonly launcherService;
|
|
8
|
+
private readonly application;
|
|
9
|
+
private readonly configDir;
|
|
10
|
+
private readonly commandMetadata;
|
|
11
|
+
private readonly authKey;
|
|
12
|
+
private isPortalServed;
|
|
13
|
+
constructor(configDir: DirectoryPath, commandMetadata: CommandMetadata, authKey?: string | null);
|
|
14
|
+
execute(buildDirectory: DirectoryPath, portalDirectory: DirectoryPath, port: number, openInBrowser: boolean, hotReload: boolean, onAfterServe?: () => void): Promise<ActionResult>;
|
|
15
|
+
private clearStandardInput;
|
|
14
16
|
}
|
|
@@ -1,24 +1,119 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
1
|
+
import { createServer as createLiveReloadServer } from "livereload";
|
|
2
|
+
import connectLiveReload from "connect-livereload";
|
|
3
|
+
import express from "express";
|
|
4
|
+
import chokidar from "chokidar";
|
|
5
|
+
import crypto from "crypto";
|
|
6
|
+
import { Mutex } from "async-mutex";
|
|
7
|
+
import { PortalServePrompts } from "../../prompts/portal/serve.js";
|
|
8
|
+
import { ActionResult } from "../action-result.js";
|
|
9
|
+
import { GenerateAction } from "./generate.js";
|
|
10
|
+
import { NetworkService } from "../../infrastructure/network-service.js";
|
|
11
|
+
import { UrlPath } from "../../types/file/urlPath.js";
|
|
12
|
+
import { LauncherService } from "../../infrastructure/launcher-service.js";
|
|
13
|
+
import { DebounceService } from "../../infrastructure/debounce-service.js";
|
|
3
14
|
export class PortalServeAction {
|
|
4
|
-
constructor(
|
|
5
|
-
this.prompts =
|
|
6
|
-
this.
|
|
7
|
-
this.
|
|
15
|
+
constructor(configDir, commandMetadata, authKey = null) {
|
|
16
|
+
this.prompts = new PortalServePrompts();
|
|
17
|
+
this.networkService = new NetworkService();
|
|
18
|
+
this.launcherService = new LauncherService();
|
|
19
|
+
this.application = express();
|
|
20
|
+
this.isPortalServed = false;
|
|
21
|
+
this.configDir = configDir;
|
|
22
|
+
this.commandMetadata = commandMetadata;
|
|
23
|
+
this.authKey = authKey;
|
|
8
24
|
}
|
|
9
|
-
async
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
25
|
+
async execute(buildDirectory, portalDirectory, port, openInBrowser, hotReload, onAfterServe) {
|
|
26
|
+
const generatePortalAction = new GenerateAction(this.configDir, this.commandMetadata, this.authKey);
|
|
27
|
+
const result = await generatePortalAction.execute(buildDirectory, portalDirectory, true, false);
|
|
28
|
+
if (result.isFailed()) {
|
|
29
|
+
return ActionResult.failed();
|
|
30
|
+
}
|
|
31
|
+
const servePort = await this.networkService.getServerPort([port, 3000, 3001, 3002]);
|
|
32
|
+
if (servePort != port && !onAfterServe) {
|
|
33
|
+
this.prompts.usingFallbackPort(port, servePort);
|
|
34
|
+
}
|
|
35
|
+
const liveReloadPort = await this.networkService.getServerPort([35729, 35730, 35731, 35732]);
|
|
36
|
+
const liveReloadServer = createLiveReloadServer({ port: liveReloadPort });
|
|
37
|
+
const server = this.application
|
|
38
|
+
.use(connectLiveReload())
|
|
39
|
+
.use(express.static(portalDirectory.toString(), { extensions: ["html"] }))
|
|
40
|
+
.listen(servePort);
|
|
41
|
+
const portalUrl = new UrlPath(`http://localhost:${servePort}`);
|
|
42
|
+
this.prompts.portalServed(portalUrl);
|
|
43
|
+
if (openInBrowser) {
|
|
44
|
+
await this.launcherService.openUrlInBrowser(portalUrl);
|
|
45
|
+
}
|
|
46
|
+
this.prompts.promptForExit();
|
|
47
|
+
if (!hotReload) {
|
|
48
|
+
if (onAfterServe) {
|
|
49
|
+
onAfterServe();
|
|
15
50
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
51
|
+
this.clearStandardInput();
|
|
52
|
+
await this.prompts.blockExecution();
|
|
53
|
+
liveReloadServer.close();
|
|
54
|
+
server.close();
|
|
55
|
+
return ActionResult.success();
|
|
56
|
+
}
|
|
57
|
+
this.prompts.hotReloadEnabled(buildDirectory);
|
|
58
|
+
const watcher = chokidar.watch(buildDirectory.toString(), {
|
|
59
|
+
ignored: [/(^|[/\\])\..+/],
|
|
60
|
+
ignoreInitial: true,
|
|
61
|
+
persistent: true,
|
|
62
|
+
awaitWriteFinish: true,
|
|
63
|
+
atomic: true
|
|
64
|
+
});
|
|
65
|
+
const deletedDirectories = new Set();
|
|
66
|
+
// TODO: Verify if we need mutex and eventQueue after refactoring.
|
|
67
|
+
const eventQueue = new Map();
|
|
68
|
+
const mutex = new Mutex();
|
|
69
|
+
const debounceService = new DebounceService();
|
|
70
|
+
watcher
|
|
71
|
+
.on("all", async (event, path) => {
|
|
72
|
+
// triggers folder deletion as a single event
|
|
73
|
+
if (event == "unlinkDir") {
|
|
74
|
+
deletedDirectories.add(path);
|
|
19
75
|
}
|
|
20
|
-
|
|
21
|
-
|
|
76
|
+
if (event == "unlink") {
|
|
77
|
+
for (const dir of deletedDirectories) {
|
|
78
|
+
if (path.startsWith(dir)) {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
const eventId = `${Date.now()}-${crypto.randomUUID()}`;
|
|
84
|
+
await mutex.runExclusive(async () => {
|
|
85
|
+
eventQueue.clear();
|
|
86
|
+
eventQueue.set(eventId, path);
|
|
87
|
+
});
|
|
88
|
+
await debounceService.batchSingleRequest(async () => {
|
|
89
|
+
this.prompts.changesDetected();
|
|
90
|
+
// TODO: Verify if this is needed.
|
|
91
|
+
if (!eventQueue.has(eventId)) {
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
await generatePortalAction.execute(buildDirectory, portalDirectory, true, false, false);
|
|
95
|
+
liveReloadServer.refresh(portalDirectory.toString());
|
|
96
|
+
this.clearStandardInput();
|
|
97
|
+
});
|
|
98
|
+
})
|
|
99
|
+
.on("error", async () => {
|
|
100
|
+
this.prompts.watcherError();
|
|
101
|
+
});
|
|
102
|
+
// Wait for SIGINT or SIGTERM
|
|
103
|
+
this.clearStandardInput();
|
|
104
|
+
await this.prompts.blockExecution();
|
|
105
|
+
await watcher.close();
|
|
106
|
+
debounceService.close();
|
|
107
|
+
liveReloadServer.close();
|
|
108
|
+
server.close();
|
|
109
|
+
return ActionResult.success();
|
|
110
|
+
}
|
|
111
|
+
// This clears the standard input to allow interrupts like CTRL+C to work properly.
|
|
112
|
+
clearStandardInput() {
|
|
113
|
+
if (process.platform !== "darwin" && process.stdin.isTTY) {
|
|
114
|
+
process.stdin.setRawMode(false);
|
|
115
|
+
process.stdin.pause();
|
|
116
|
+
}
|
|
22
117
|
}
|
|
23
118
|
}
|
|
24
119
|
//# sourceMappingURL=serve.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serve.js","sourceRoot":"","sources":["../../../src/actions/portal/serve.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"serve.js","sourceRoot":"","sources":["../../../src/actions/portal/serve.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,IAAI,sBAAsB,EAAE,MAAM,YAAY,CAAC;AACpE,OAAO,iBAAiB,MAAM,oBAAoB,CAAC;AACnD,OAAO,OAAoB,MAAM,SAAS,CAAC;AAC3C,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAEnE,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEnD,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,0CAA0C,CAAC;AAC3E,OAAO,EAAE,eAAe,EAAE,MAAM,0CAA0C,CAAC;AAE3E,MAAM,OAAO,iBAAiB;IAU5B,YAAmB,SAAwB,EAAE,eAAgC,EAAE,UAAyB,IAAI;QAT3F,YAAO,GAAuB,IAAI,kBAAkB,EAAE,CAAC;QACvD,mBAAc,GAAmB,IAAI,cAAc,EAAE,CAAC;QACtD,oBAAe,GAAoB,IAAI,eAAe,EAAE,CAAC;QACzD,gBAAW,GAAY,OAAO,EAAE,CAAC;QAI1C,mBAAc,GAAY,KAAK,CAAC;QAGtC,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;QAC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;QAC1B,MAAM,IAAI,CAAC,OAAO,CAAC,cAAc,EAAE,CAAC;QAEpC,MAAM,OAAO,CAAC,KAAK,EAAE,CAAC;QACtB,eAAe,CAAC,KAAK,EAAE,CAAC;QAExB,gBAAgB,CAAC,KAAK,EAAE,CAAC;QACzB,MAAM,CAAC,KAAK,EAAE,CAAC;QACf,OAAO,YAAY,CAAC,OAAO,EAAE,CAAC;IAChC,CAAC;IAED,mFAAmF;IAC3E,kBAAkB;QACxB,IAAI,OAAO,CAAC,QAAQ,KAAK,QAAQ,IAAI,OAAO,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;YACzD,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;YAChC,OAAO,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;QACxB,CAAC;IACH,CAAC;CACF"}
|
|
@@ -1,20 +1,21 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { TocGroup } from "../../../types/toc/toc.js";
|
|
2
2
|
import { DirectoryPath } from "../../../types/file/directoryPath.js";
|
|
3
|
+
import { CommandMetadata } from "../../../types/common/command-metadata.js";
|
|
4
|
+
import { ActionResult } from "../../action-result.js";
|
|
5
|
+
export declare class ContentContext {
|
|
6
|
+
private readonly contentDirectory;
|
|
7
|
+
private readonly fileService;
|
|
8
|
+
constructor(contentDirectory: DirectoryPath);
|
|
9
|
+
exists(): Promise<boolean>;
|
|
10
|
+
extractContentGroups(): Promise<TocGroup[]>;
|
|
11
|
+
}
|
|
3
12
|
export declare class PortalNewTocAction {
|
|
13
|
+
private readonly configDirectory;
|
|
14
|
+
private readonly commandMetadata;
|
|
4
15
|
private readonly prompts;
|
|
5
|
-
private readonly sdlParser;
|
|
6
16
|
private readonly tocGenerator;
|
|
7
|
-
private readonly
|
|
8
|
-
private readonly
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
createToc(buildDirectory: DirectoryPath, configDir: string, commandName: string, tocDirectory?: DirectoryPath, force?: boolean, expandEndpoints?: boolean, expandModels?: boolean): Promise<Result<string, string>>;
|
|
12
|
-
private writeToc;
|
|
13
|
-
private handleExistingToc;
|
|
14
|
-
private extractSdlComponents;
|
|
15
|
-
private extractContentGroups;
|
|
16
|
-
private getDestinationPath;
|
|
17
|
-
private checkExistingToc;
|
|
18
|
-
private getContentFolderPath;
|
|
19
|
-
private getSpecFolderPath;
|
|
17
|
+
private readonly fileService;
|
|
18
|
+
private readonly portalService;
|
|
19
|
+
constructor(configDirectory: DirectoryPath, commandMetadata: CommandMetadata);
|
|
20
|
+
execute(buildDirectory: DirectoryPath, tocDirectory?: DirectoryPath, force?: boolean, expandEndpoints?: boolean, expandModels?: boolean): Promise<ActionResult>;
|
|
20
21
|
}
|
|
@@ -1,133 +1,97 @@
|
|
|
1
|
-
import
|
|
2
|
-
import fsExtra from "fs-extra";
|
|
1
|
+
import { ok } from "neverthrow";
|
|
3
2
|
import { PortalNewTocPrompts } from "../../../prompts/portal/toc/new-toc.js";
|
|
4
|
-
import { Result } from "../../../types/common/result.js";
|
|
5
|
-
import { getMessageInRedColor } from "../../../utils/utils.js";
|
|
6
|
-
import { SdlParser } from "../../../application/portal/toc/sdl-parser.js";
|
|
7
3
|
import { TocStructureGenerator } from "../../../application/portal/toc/toc-structure-generator.js";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import { FileName } from "../../../types/file/fileName.js";
|
|
4
|
+
import { ActionResult } from "../../action-result.js";
|
|
5
|
+
import { TocContext } from "../../../types/toc-context.js";
|
|
6
|
+
import { FileService } from "../../../infrastructure/file-service.js";
|
|
12
7
|
import { BuildContext } from "../../../types/build-context.js";
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
this.
|
|
20
|
-
this.
|
|
21
|
-
}
|
|
22
|
-
async createToc(buildDirectory, configDir, commandName, tocDirectory, force = false, expandEndpoints = false, expandModels = false) {
|
|
23
|
-
try {
|
|
24
|
-
const tocDir = await this.getDestinationPath(buildDirectory, tocDirectory);
|
|
25
|
-
const tocPath = new FilePath(tocDir, new FileName(this.DEFAULT_TOC_FILENAME));
|
|
26
|
-
const tocCheckResult = await this.handleExistingToc(tocPath, force);
|
|
27
|
-
if (!tocCheckResult.isSuccess()) {
|
|
28
|
-
return Result.cancelled(tocCheckResult.value);
|
|
29
|
-
}
|
|
30
|
-
const { endpointGroups, models } = await this.extractSdlComponents(buildDirectory, configDir, commandName, expandEndpoints, expandModels);
|
|
31
|
-
const contentGroups = await this.extractContentGroups(buildDirectory);
|
|
32
|
-
const toc = this.tocGenerator.createTocStructure(endpointGroups, models, expandEndpoints, expandModels, contentGroups);
|
|
33
|
-
const yamlString = this.tocGenerator.transformToYaml(toc);
|
|
34
|
-
await this.writeToc(tocPath.toString(), yamlString, "utf8");
|
|
35
|
-
this.prompts.displayOutroMessage(tocPath);
|
|
36
|
-
return Result.success(tocPath.toString());
|
|
37
|
-
}
|
|
38
|
-
catch (error) {
|
|
39
|
-
this.prompts.logError(getMessageInRedColor(`${error.message}`));
|
|
40
|
-
return Result.failure(`An unexpected error occurred while generating the TOC file.`);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
async writeToc(path, content, encoding) {
|
|
44
|
-
await fsExtra.ensureFile(path);
|
|
45
|
-
await fsExtra.writeFile(path, content, encoding);
|
|
46
|
-
}
|
|
47
|
-
async handleExistingToc(tocPath, force) {
|
|
48
|
-
const shouldContinue = await this.checkExistingToc(tocPath, force);
|
|
49
|
-
if (!shouldContinue) {
|
|
50
|
-
return Result.cancelled("Operation was cancelled by the user.");
|
|
51
|
-
}
|
|
52
|
-
return Result.success("TOC check passed.");
|
|
53
|
-
}
|
|
54
|
-
async extractSdlComponents(buildDirectory, configDir, commandName, expandEndpoints, expandModels) {
|
|
55
|
-
if (!expandEndpoints && !expandModels) {
|
|
56
|
-
return { endpointGroups: new Map(), models: [] };
|
|
57
|
-
}
|
|
58
|
-
this.prompts.startProgressIndicatorWithMessage("Extracting endpoints and/or models from the API specification...");
|
|
59
|
-
const specFolderPath = await this.getSpecFolderPath(buildDirectory);
|
|
60
|
-
if (!(await fsExtra.pathExists(specFolderPath))) {
|
|
61
|
-
this.prompts.stopProgressIndicatorWithMessage(`⚠️ Could not find the specification folder at: ${specFolderPath}`);
|
|
62
|
-
this.prompts.displayInfo("Falling back to default TOC structure without expanded endpoints or models...");
|
|
63
|
-
return { endpointGroups: new Map(), models: [] };
|
|
64
|
-
}
|
|
65
|
-
const sdlResult = await this.sdlParser.getTocComponentsFromSdl(specFolderPath, configDir, commandName);
|
|
66
|
-
if (!sdlResult.isSuccess()) {
|
|
67
|
-
this.prompts.stopProgressIndicatorWithMessage(`⚠️ ${sdlResult.error}`);
|
|
68
|
-
this.prompts.displayInfo("Falling back to default TOC structure without expanded endpoints or models...");
|
|
69
|
-
return { endpointGroups: new Map(), models: [] };
|
|
70
|
-
}
|
|
71
|
-
this.prompts.stopProgressIndicatorWithMessage("Successfully extracted endpoints and/or models from the specification.");
|
|
72
|
-
return sdlResult.value;
|
|
8
|
+
import { getEndpointGroupsAndModels } from "../../../types/sdl/sdl.js";
|
|
9
|
+
import { withDirPath } from "../../../infrastructure/tmp-extensions.js";
|
|
10
|
+
import { TempContext } from "../../../types/temp-context.js";
|
|
11
|
+
import { PortalService } from "../../../infrastructure/services/portal-service.js";
|
|
12
|
+
export class ContentContext {
|
|
13
|
+
constructor(contentDirectory) {
|
|
14
|
+
this.contentDirectory = contentDirectory;
|
|
15
|
+
this.fileService = new FileService();
|
|
73
16
|
}
|
|
74
|
-
async
|
|
75
|
-
|
|
76
|
-
if (!(await fsExtra.pathExists(contentFolderPath.toString()))) {
|
|
77
|
-
this.prompts.displayInfo(`⚠️ Could not locate the content folder at: ${contentFolderPath}`);
|
|
78
|
-
this.prompts.displayInfo("Skipping custom content addition in TOC...");
|
|
79
|
-
return [];
|
|
80
|
-
}
|
|
81
|
-
return await this.contentParser.parseContentFolder(contentFolderPath.toString(), contentFolderPath.toString());
|
|
17
|
+
async exists() {
|
|
18
|
+
return this.fileService.directoryExists(this.contentDirectory);
|
|
82
19
|
}
|
|
83
|
-
async
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
return inferredDestination;
|
|
87
|
-
}
|
|
88
|
-
return providedTocDirectory;
|
|
20
|
+
async extractContentGroups() {
|
|
21
|
+
const directory = await this.fileService.getDirectory(this.contentDirectory);
|
|
22
|
+
return await directory.parseContentFolder(this.contentDirectory);
|
|
89
23
|
}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
24
|
+
}
|
|
25
|
+
export class PortalNewTocAction {
|
|
26
|
+
constructor(configDirectory, commandMetadata) {
|
|
27
|
+
this.configDirectory = configDirectory;
|
|
28
|
+
this.commandMetadata = commandMetadata;
|
|
29
|
+
this.prompts = new PortalNewTocPrompts();
|
|
30
|
+
this.tocGenerator = new TocStructureGenerator();
|
|
31
|
+
this.fileService = new FileService();
|
|
32
|
+
this.portalService = new PortalService();
|
|
95
33
|
}
|
|
96
|
-
async
|
|
97
|
-
var _a;
|
|
34
|
+
async execute(buildDirectory, tocDirectory, force = false, expandEndpoints = false, expandModels = false) {
|
|
35
|
+
var _a, _b;
|
|
36
|
+
// Validate build directory
|
|
98
37
|
const buildContext = new BuildContext(buildDirectory);
|
|
99
|
-
const defaultContentFolder = buildDirectory.join("content");
|
|
100
38
|
if (!(await buildContext.validate())) {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
try {
|
|
104
|
-
const buildConfig = await buildContext.getBuildFileContents();
|
|
105
|
-
if (((_a = buildConfig.generatePortal) === null || _a === void 0 ? void 0 : _a.contentFolder) == null) {
|
|
106
|
-
return defaultContentFolder;
|
|
107
|
-
}
|
|
108
|
-
return buildDirectory.join(buildConfig.generatePortal.contentFolder).join("content");
|
|
39
|
+
this.prompts.invalidBuildDirectory(buildDirectory);
|
|
40
|
+
return ActionResult.failed();
|
|
109
41
|
}
|
|
110
|
-
|
|
111
|
-
|
|
42
|
+
const buildConfig = await buildContext.getBuildFileContents();
|
|
43
|
+
const contentDirectory = buildDirectory.join((_b = (_a = buildConfig.generatePortal) === null || _a === void 0 ? void 0 : _a.contentFolder) !== null && _b !== void 0 ? _b : "content");
|
|
44
|
+
const tocDir = tocDirectory !== null && tocDirectory !== void 0 ? tocDirectory : contentDirectory;
|
|
45
|
+
const tocContext = new TocContext(tocDir);
|
|
46
|
+
if (!force && (await tocContext.exists()) && !(await this.prompts.overwriteToc(tocContext.tocPath))) {
|
|
47
|
+
this.prompts.tocFileAlreadyExists();
|
|
48
|
+
return ActionResult.cancelled();
|
|
112
49
|
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
50
|
+
let sdlComponents = { endpointGroups: new Map(), models: [] };
|
|
51
|
+
if (expandEndpoints || expandModels) {
|
|
52
|
+
const specDirectory = buildDirectory.join("spec");
|
|
53
|
+
if (!(await this.fileService.directoryExists(specDirectory))) {
|
|
54
|
+
this.prompts.fallingBackToDefault();
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
const sdlResult = await withDirPath(async (tempDirectory) => {
|
|
58
|
+
const tempContext = new TempContext(tempDirectory);
|
|
59
|
+
const specZipPath = await tempContext.zip(specDirectory);
|
|
60
|
+
const specFileStream = await this.fileService.getStream(specZipPath);
|
|
61
|
+
try {
|
|
62
|
+
const result = await this.prompts.extractEndpointGroupsAndModels(this.portalService.generateSdl(specFileStream, this.configDirectory, this.commandMetadata));
|
|
63
|
+
if (result.isErr()) {
|
|
64
|
+
this.prompts.fallingBackToDefault();
|
|
65
|
+
return ok({ endpointGroups: new Map(), models: [] });
|
|
66
|
+
}
|
|
67
|
+
return ok(getEndpointGroupsAndModels(result.value));
|
|
68
|
+
}
|
|
69
|
+
finally {
|
|
70
|
+
specFileStream.close();
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
if (sdlResult.isErr()) {
|
|
74
|
+
this.prompts.logError(sdlResult.error);
|
|
75
|
+
return ActionResult.failed();
|
|
76
|
+
}
|
|
77
|
+
sdlComponents = sdlResult.value;
|
|
125
78
|
}
|
|
126
|
-
return path.join(buildDirectory.toString(), buildConfig.generatePortal.apiSpecPath);
|
|
127
79
|
}
|
|
128
|
-
|
|
129
|
-
|
|
80
|
+
const contentContext = new ContentContext(contentDirectory);
|
|
81
|
+
const contentExists = await contentContext.exists();
|
|
82
|
+
let contentGroups;
|
|
83
|
+
if (!contentExists) {
|
|
84
|
+
this.prompts.contentDirectoryNotFound(contentDirectory);
|
|
85
|
+
contentGroups = [];
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
contentGroups = await contentContext.extractContentGroups();
|
|
130
89
|
}
|
|
90
|
+
const toc = this.tocGenerator.createTocStructure(sdlComponents.endpointGroups, sdlComponents.models, expandEndpoints, expandModels, contentGroups);
|
|
91
|
+
const yamlString = this.tocGenerator.transformToYaml(toc);
|
|
92
|
+
const tocFilePath = await tocContext.save(yamlString);
|
|
93
|
+
this.prompts.tocCreated(tocFilePath);
|
|
94
|
+
return ActionResult.success();
|
|
131
95
|
}
|
|
132
96
|
}
|
|
133
97
|
//# sourceMappingURL=new-toc.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"new-toc.js","sourceRoot":"","sources":["../../../../src/actions/portal/toc/new-toc.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"new-toc.js","sourceRoot":"","sources":["../../../../src/actions/portal/toc/new-toc.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,EAAE,EAAU,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAC7E,OAAO,EAAE,qBAAqB,EAAE,MAAM,4DAA4D,CAAC;AAInG,OAAO,EAAE,Y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AM,cAAc,GAAG,IAAI,cAAc,CAAC,gBAAgB,CAAC,CAAC;QAC5D,MAAM,aAAa,GAAG,MAAM,cAAc,CAAC,MAAM,EAAE,CAAC;QAEpD,IAAI,aAAyB,CAAC;QAC9B,IAAI,CAAC,aAAa,EAAE,CAAC;YACnB,IAAI,CAAC,OAAO,CAAC,wBAAwB,CAAC,gBAAgB,CAAC,CAAC;YACxD,aAAa,GAAG,EAAE,CAAC;QACrB,CAAC;aAAM,CAAC;YACN,aAAa,GAAG,MAAM,cAAc,CAAC,oBAAoB,EAAE,CAAC;QAC9D,CAAC;QAGD,MAAM,GAAG,GAAG,IAAI,CAAC,YAAY,CAAC,kBAAkB,CAC9C,aAAa,CAAC,cAAc,EAC5B,aAAa,CAAC,MAAM,EACpB,eAAe,EACf,YAAY,EACZ,aAAa,CACd,CAAC;QAEF,MAAM,UAAU,GAAG,IAAI,CAAC,YAAY,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC;QAC1D,MAAM,WAAW,GAAG,MAAM,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAGtD,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,WAAW,CAAC,CAAA;QAEpC,OAAO,YAAY,CAAC,OAAO,EAAE,CAAC;IAChC,CAAC;CACF"}
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { DirectoryPath } from "../../types/file/directoryPath.js";
|
|
2
2
|
import { ActionResult } from "../action-result.js";
|
|
3
|
-
import {
|
|
3
|
+
import { CommandMetadata } from "../../types/common/command-metadata.js";
|
|
4
|
+
import { Language } from "../../types/sdk/generate.js";
|
|
4
5
|
export declare class GenerateAction {
|
|
5
6
|
private readonly prompts;
|
|
6
|
-
private readonly zipArchiver;
|
|
7
|
-
private readonly fileService;
|
|
8
7
|
private readonly portalService;
|
|
9
8
|
private readonly configDir;
|
|
9
|
+
private readonly commandMetadata;
|
|
10
10
|
private readonly authKey;
|
|
11
|
-
constructor(configDir: DirectoryPath, authKey?: string | null);
|
|
12
|
-
readonly execute: (specDirectory: DirectoryPath, sdkDirectory: DirectoryPath,
|
|
13
|
-
private convertSimplePlatformToPlatform;
|
|
11
|
+
constructor(configDir: DirectoryPath, commandMetadata: CommandMetadata, authKey?: string | null);
|
|
12
|
+
readonly execute: (specDirectory: DirectoryPath, sdkDirectory: DirectoryPath, language: Language, force: boolean, zipSdk: boolean) => Promise<ActionResult>;
|
|
14
13
|
}
|
|
@@ -1,72 +1,47 @@
|
|
|
1
|
-
import { ZipService } from "../../infrastructure/zip-service.js";
|
|
2
|
-
import { FileService } from "../../infrastructure/file-service.js";
|
|
3
1
|
import { PortalService } from "../../infrastructure/services/portal-service.js";
|
|
4
|
-
import { FilePath } from "../../types/file/filePath.js";
|
|
5
|
-
import { FileName } from "../../types/file/fileName.js";
|
|
6
2
|
import { ActionResult } from "../action-result.js";
|
|
7
3
|
import { withDirPath } from "../../infrastructure/tmp-extensions.js";
|
|
8
4
|
import { SdkContext } from "../../types/sdk-context.js";
|
|
9
|
-
import { Platforms } from "@apimatic/sdk";
|
|
10
5
|
import { SpecContext } from "../../types/spec-context.js";
|
|
11
6
|
import { SdkGeneratePrompts } from "../../prompts/sdk/generate.js";
|
|
12
|
-
import {
|
|
7
|
+
import { TempContext } from "../../types/temp-context.js";
|
|
13
8
|
export class GenerateAction {
|
|
14
|
-
constructor(configDir, authKey = null) {
|
|
9
|
+
constructor(configDir, commandMetadata, authKey = null) {
|
|
15
10
|
this.prompts = new SdkGeneratePrompts();
|
|
16
|
-
this.zipArchiver = new ZipService();
|
|
17
|
-
this.fileService = new FileService();
|
|
18
11
|
this.portalService = new PortalService();
|
|
19
|
-
this.execute = async (specDirectory, sdkDirectory,
|
|
12
|
+
this.execute = async (specDirectory, sdkDirectory, language, force, zipSdk) => {
|
|
20
13
|
if (specDirectory.isEqual(sdkDirectory)) {
|
|
21
|
-
|
|
14
|
+
this.prompts.sameSpecAndSdkDir(specDirectory);
|
|
15
|
+
return ActionResult.failed();
|
|
22
16
|
}
|
|
23
17
|
const specContext = new SpecContext(specDirectory);
|
|
24
18
|
if (!(await specContext.validate())) {
|
|
25
|
-
|
|
19
|
+
this.prompts.invalidSpecDirectory(specDirectory);
|
|
20
|
+
return ActionResult.failed();
|
|
26
21
|
}
|
|
27
|
-
const sdkContext = new SdkContext(sdkDirectory,
|
|
28
|
-
if (!force && (await sdkContext.exists()) && !(await this.prompts.overwriteSdk(
|
|
29
|
-
|
|
22
|
+
const sdkContext = new SdkContext(sdkDirectory, language);
|
|
23
|
+
if (!force && (await sdkContext.exists()) && !(await this.prompts.overwriteSdk(sdkContext.sdkLanguageDirectory))) {
|
|
24
|
+
this.prompts.destinationDirNotEmpty();
|
|
25
|
+
return ActionResult.cancelled();
|
|
30
26
|
}
|
|
31
27
|
return await withDirPath(async (tempDirectory) => {
|
|
32
|
-
|
|
33
|
-
const specZipPath =
|
|
34
|
-
await this.
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
return ActionResult.error(response.error);
|
|
28
|
+
const tempContext = new TempContext(tempDirectory);
|
|
29
|
+
const specZipPath = await tempContext.zip(specDirectory);
|
|
30
|
+
const response = await this.prompts.generateSDK(this.portalService.generateSdk(specZipPath, language, this.configDir, this.commandMetadata, this.authKey));
|
|
31
|
+
// TODO: this should be service error
|
|
32
|
+
if (response.isErr()) {
|
|
33
|
+
this.prompts.logGenerationError(response.error);
|
|
34
|
+
return ActionResult.failed();
|
|
40
35
|
}
|
|
41
|
-
const tempSdkFilePath =
|
|
42
|
-
await
|
|
43
|
-
|
|
44
|
-
this.prompts.displaySdkGenerationSuccessMessage();
|
|
36
|
+
const tempSdkFilePath = await tempContext.save(response.value);
|
|
37
|
+
const sdkLanguageDirectory = await sdkContext.save(tempSdkFilePath, zipSdk);
|
|
38
|
+
this.prompts.sdkGenerated(sdkLanguageDirectory);
|
|
45
39
|
return ActionResult.success();
|
|
46
40
|
});
|
|
47
41
|
};
|
|
48
42
|
this.configDir = configDir;
|
|
43
|
+
this.commandMetadata = commandMetadata;
|
|
49
44
|
this.authKey = authKey;
|
|
50
45
|
}
|
|
51
|
-
convertSimplePlatformToPlatform(languagePlatform) {
|
|
52
|
-
switch (languagePlatform) {
|
|
53
|
-
case LanguagePlatform.CSHARP:
|
|
54
|
-
return Platforms.CsNetStandardLib;
|
|
55
|
-
case LanguagePlatform.JAVA:
|
|
56
|
-
return Platforms.JavaEclipseJreLib;
|
|
57
|
-
case LanguagePlatform.PHP:
|
|
58
|
-
return Platforms.PhpGenericLibV2;
|
|
59
|
-
case LanguagePlatform.PYTHON:
|
|
60
|
-
return Platforms.PythonGenericLib;
|
|
61
|
-
case LanguagePlatform.RUBY:
|
|
62
|
-
return Platforms.RubyGenericLib;
|
|
63
|
-
case LanguagePlatform.TYPESCRIPT:
|
|
64
|
-
return Platforms.TsGenericLib;
|
|
65
|
-
case LanguagePlatform.GO:
|
|
66
|
-
return Platforms.GoGenericLib;
|
|
67
|
-
default:
|
|
68
|
-
throw new Error(`Unknown LanguagePlatform: ${languagePlatform}`);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
46
|
}
|
|
72
47
|
//# sourceMappingURL=generate.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate.js","sourceRoot":"","sources":["../../../src/actions/sdk/generate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"generate.js","sourceRoot":"","sources":["../../../src/actions/sdk/generate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iDAAiD,CAAC;AAEhF,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,wCAAwC,CAAC;AACrE,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+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