@apimatic/cli 1.1.0-alpha.20 → 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 +119 -91
- 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 +7 -2
- package/lib/actions/portal/copilot.js +72 -32
- package/lib/actions/portal/copilot.js.map +1 -1
- package/lib/actions/portal/generate.d.ts +5 -5
- package/lib/actions/portal/generate.js +33 -35
- 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 -91
- 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 -60
- 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 +3 -2
- package/lib/commands/portal/copilot.js +23 -21
- package/lib/commands/portal/copilot.js.map +1 -1
- package/lib/commands/portal/generate.d.ts +3 -4
- package/lib/commands/portal/generate.js +18 -13
- package/lib/commands/portal/generate.js.map +1 -1
- package/lib/commands/portal/quickstart.d.ts +3 -4
- package/lib/commands/portal/quickstart.js +27 -95
- 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.d.ts +3 -0
- package/lib/hooks/not-found.js +52 -0
- package/lib/hooks/not-found.js.map +1 -0
- package/lib/hooks/utils.d.ts +5 -0
- package/lib/hooks/utils.js +51 -0
- package/lib/hooks/utils.js.map +1 -0
- 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 +5 -1
- package/lib/infrastructure/env-info.js +23 -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 +49 -8
- package/lib/infrastructure/file-service.js.map +1 -1
- package/lib/infrastructure/launcher-service.d.ts +7 -0
- package/lib/infrastructure/launcher-service.js +51 -0
- package/lib/infrastructure/launcher-service.js.map +1 -0
- 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 +8 -7
- 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 +10 -6
- 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 +12 -11
- package/lib/infrastructure/services/portal-service.js +77 -83
- 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 +15 -5
- package/lib/prompts/portal/copilot.js +49 -21
- 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.d.ts +7 -0
- package/lib/types/events/quickstart-completed.js +10 -0
- package/lib/types/events/quickstart-completed.js.map +1 -0
- package/lib/types/events/quickstart-initiated.d.ts +7 -0
- package/lib/types/events/quickstart-initiated.js +10 -0
- package/lib/types/events/quickstart-initiated.js.map +1 -0
- 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 +3 -1
- package/lib/types/file/fileName.js +14 -2
- 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 +11 -10
- 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 -22
- package/lib/client-utils/sdk-client.js +0 -89
- 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 -15
- package/lib/controllers/portal/quickstart.js +0 -217
- package/lib/controllers/portal/quickstart.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
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { ActionResult } from "../action-result.js";
|
|
2
|
+
import { ApiValidatePrompts } from "../../prompts/api/validate.js";
|
|
3
|
+
import { ValidationService } from "../../infrastructure/services/validation-service.js";
|
|
4
|
+
import { withDirPath } from "../../infrastructure/tmp-extensions.js";
|
|
5
|
+
import { ResourceContext } from "../../types/resource-context.js";
|
|
6
|
+
export class ValidateAction {
|
|
7
|
+
constructor(configDir, commandMetadata, authKey = null) {
|
|
8
|
+
this.prompts = new ApiValidatePrompts();
|
|
9
|
+
this.execute = async (resourcePath, displayValidationSummary = true) => {
|
|
10
|
+
return await withDirPath(async (tempDirectory) => {
|
|
11
|
+
const resourceContext = new ResourceContext(tempDirectory);
|
|
12
|
+
const specFileDirResult = await resourceContext.resolveTo(resourcePath);
|
|
13
|
+
if (specFileDirResult.isErr()) {
|
|
14
|
+
this.prompts.networkError(specFileDirResult.error);
|
|
15
|
+
return ActionResult.failed();
|
|
16
|
+
}
|
|
17
|
+
const validationSummaryResult = await this.prompts.validateApi(this.validationService.validateViaFile({
|
|
18
|
+
file: specFileDirResult.value,
|
|
19
|
+
commandMetadata: this.commandMetadata,
|
|
20
|
+
authKey: this.authKey
|
|
21
|
+
}));
|
|
22
|
+
if (validationSummaryResult.isErr()) {
|
|
23
|
+
this.prompts.logValidationError(validationSummaryResult.error);
|
|
24
|
+
return ActionResult.failed();
|
|
25
|
+
}
|
|
26
|
+
const validationSummary = validationSummaryResult.value;
|
|
27
|
+
if (displayValidationSummary) {
|
|
28
|
+
this.prompts.displayValidationMessages(validationSummary);
|
|
29
|
+
}
|
|
30
|
+
if (!validationSummary.success) {
|
|
31
|
+
return ActionResult.failed();
|
|
32
|
+
}
|
|
33
|
+
return ActionResult.success();
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
this.authKey = authKey;
|
|
37
|
+
this.validationService = new ValidationService(configDir);
|
|
38
|
+
this.commandMetadata = commandMetadata;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=validate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate.js","sourceRoot":"","sources":["../../../src/actions/api/validate.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,qDAAqD,CAAC;AAGxF,OAAO,EAAE,WAAW,EAAE,MAAM,wCAAwC,CAAC;AACrE,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAElE,MAAM,OAAO,cAAc;IAMzB,YAAY,SAAwB,EAAE,eAAgC,EAAE,UAAyB,IAAI;QALpF,YAAO,GAAuB,IAAI,kBAAkB,EAAE,CAAC;QAWxD,YAAO,GAAG,KAAK,EAC7B,YAA2B,EAC3B,wBAAwB,GAAG,IAAI,EACR,EAAE;YACzB,OAAO,MAAM,WAAW,CAAC,KAAK,EAAE,aAAa,EAAE,E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AAC,CAAC;QAC1D,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;IACzC,CAAC;CAoCF"}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { DirectoryPath } from "../../types/file/directoryPath.js";
|
|
2
|
-
import {
|
|
2
|
+
import { CommandMetadata } from "../../types/common/command-metadata.js";
|
|
3
|
+
import { ActionResult } from "../action-result.js";
|
|
3
4
|
export declare class LoginAction {
|
|
4
5
|
private readonly configDir;
|
|
6
|
+
private readonly commandMetadata;
|
|
5
7
|
private readonly authService;
|
|
6
8
|
private readonly apiService;
|
|
7
9
|
private readonly prompts;
|
|
8
|
-
constructor(configDir: DirectoryPath);
|
|
9
|
-
execute(apiKey?: string | undefined): Promise<
|
|
10
|
-
private
|
|
11
|
-
private verifyKeyAndSave;
|
|
10
|
+
constructor(configDir: DirectoryPath, commandMetadata: CommandMetadata);
|
|
11
|
+
execute(apiKey?: string | undefined): Promise<ActionResult>;
|
|
12
|
+
private pollDeviceToken;
|
|
12
13
|
}
|
|
@@ -1,30 +1,39 @@
|
|
|
1
1
|
import { AuthService } from "../../infrastructure/services/auth-service.js";
|
|
2
2
|
import { ApiService } from "../../infrastructure/services/api-service.js";
|
|
3
|
-
import { err, ok } from "neverthrow";
|
|
4
3
|
import { v4 as uuid } from "uuid";
|
|
5
4
|
import open from "open";
|
|
6
5
|
import { setAuthInfo } from "../../client-utils/auth-manager.js";
|
|
7
6
|
import { LoginPrompts } from "../../prompts/auth/login.js";
|
|
8
|
-
import {
|
|
7
|
+
import { ActionResult } from "../action-result.js";
|
|
8
|
+
import { err, ok } from "neverthrow";
|
|
9
9
|
export class LoginAction {
|
|
10
|
-
constructor(configDir) {
|
|
10
|
+
constructor(configDir, commandMetadata) {
|
|
11
11
|
this.configDir = configDir;
|
|
12
|
+
this.commandMetadata = commandMetadata;
|
|
12
13
|
this.authService = new AuthService();
|
|
13
14
|
this.apiService = new ApiService();
|
|
14
15
|
this.prompts = new LoginPrompts();
|
|
15
16
|
}
|
|
16
17
|
async execute(apiKey = undefined) {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
})).andThen((r) => r);
|
|
18
|
+
const apiKeyResult = await this.pollDeviceToken(apiKey, this.commandMetadata.shell);
|
|
19
|
+
if (apiKeyResult.isErr()) {
|
|
20
|
+
this.prompts.loginTimeout();
|
|
21
|
+
return ActionResult.failed();
|
|
22
22
|
}
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
// TODO: Use status endpoint here
|
|
24
|
+
// Problem, we don't have email info here, just the key and required for setAuthInfo
|
|
25
|
+
const accountInfoResult = await this.prompts.accountInfoSpinner(this.apiService.getAccountInfo(this.configDir, this.commandMetadata.shell, apiKeyResult.value));
|
|
26
|
+
if (accountInfoResult.isErr()) {
|
|
27
|
+
this.prompts.invalidKeyProvided(accountInfoResult.error);
|
|
28
|
+
return ActionResult.failed();
|
|
25
29
|
}
|
|
30
|
+
await setAuthInfo(accountInfoResult.value.Email, apiKeyResult.value, false, this.configDir);
|
|
31
|
+
this.prompts.loginSuccessful(accountInfoResult.value.Email);
|
|
32
|
+
return ActionResult.success();
|
|
26
33
|
}
|
|
27
|
-
async
|
|
34
|
+
async pollDeviceToken(apiKey, shell) {
|
|
35
|
+
if (apiKey)
|
|
36
|
+
return ok(apiKey);
|
|
28
37
|
const state = uuid();
|
|
29
38
|
this.prompts.openBrowser();
|
|
30
39
|
await open(this.authService.getDeviceLoginUrl(state));
|
|
@@ -33,31 +42,14 @@ export class LoginAction {
|
|
|
33
42
|
const delayMs = 3 * 1000;
|
|
34
43
|
while (true) {
|
|
35
44
|
if (Date.now() - startTime > timeoutDuration) {
|
|
36
|
-
return err("
|
|
45
|
+
return err("TIMEOUT");
|
|
46
|
+
}
|
|
47
|
+
const result = await this.authService.getDeviceLoginToken(state, shell);
|
|
48
|
+
if (result.isOk()) {
|
|
49
|
+
return ok(result.value.apiKey);
|
|
37
50
|
}
|
|
38
|
-
const result = await this.authService.getDeviceLoginToken(state);
|
|
39
|
-
const token = result.match((res) => res.apiKey, () => {
|
|
40
|
-
/* ignore errors */
|
|
41
|
-
});
|
|
42
|
-
if (token)
|
|
43
|
-
return ok(token);
|
|
44
|
-
// eslint-disable-next-line no-undef
|
|
45
51
|
await new Promise((resolve) => setTimeout(resolve, delayMs));
|
|
46
52
|
}
|
|
47
53
|
}
|
|
48
|
-
async verifyKeyAndSave(apiKey) {
|
|
49
|
-
const result = await this.apiService.getAccountInfo(this.configDir, apiKey);
|
|
50
|
-
return result.asyncMap(async (info) => {
|
|
51
|
-
await setAuthInfo(info.Email, apiKey, false, this.configDir);
|
|
52
|
-
return info.Email;
|
|
53
|
-
}).mapErr(e => {
|
|
54
|
-
switch (e) {
|
|
55
|
-
case "UNAUTHORIZED" /* ServiceError.UnAuthorized */:
|
|
56
|
-
return "The provided auth key is invalid";
|
|
57
|
-
default:
|
|
58
|
-
return getErrorMessage(e);
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
54
|
}
|
|
63
55
|
//# sourceMappingURL=login.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"login.js","sourceRoot":"","sources":["../../../src/actions/auth/login.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,+CAA+C,CAAC;AAC5E,OAAO,EAAE,UAAU,EAAE,MAAM,8CAA8C,CAAC;AAE1E,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"login.js","sourceRoot":"","sources":["../../../src/actions/auth/login.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,+CAA+C,CAAC;AAC5E,OAAO,EAAE,UAAU,EAAE,MAAM,8CAA8C,CAAC;AAE1E,OAAO,EAAE,EAAE,IAAI,IAAI,EAAE,MAAM,MAAM,CAAC;AAClC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAC;AACjE,OAAO,EAAE,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js";
|
|
2
|
+
import { ActionResult } from "../action-result.js";
|
|
3
|
+
export declare class LogoutAction {
|
|
4
|
+
private readonly configDir;
|
|
5
|
+
private readonly prompts;
|
|
6
|
+
constructor(configDir: DirectoryPath);
|
|
7
|
+
execute(): Promise<ActionResult>;
|
|
8
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ActionResult } from "../action-result.js";
|
|
2
|
+
import { removeAuthInfo } from "../../client-utils/auth-manager.js";
|
|
3
|
+
import { LogoutPrompts } from "../../prompts/auth/logout.js";
|
|
4
|
+
export class LogoutAction {
|
|
5
|
+
constructor(configDir) {
|
|
6
|
+
this.configDir = configDir;
|
|
7
|
+
this.prompts = new LogoutPrompts();
|
|
8
|
+
}
|
|
9
|
+
async execute() {
|
|
10
|
+
await removeAuthInfo(this.configDir);
|
|
11
|
+
this.prompts.removeAuthInfo();
|
|
12
|
+
return ActionResult.success();
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=logout.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logout.js","sourceRoot":"","sources":["../../../src/actions/auth/logout.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAE7D,MAAM,OAAO,YAAY;IAGvB,YAA6B,SAAwB;QAAxB,cAAS,GAAT,SAAS,CAAe;QAFpC,YAAO,GAAG,IAAI,aAAa,EAAE,CAAC;IAES,CAAC;IAElD,KAAK,CAAC,OAAO;QAClB,MAAM,cAAc,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACrC,IAAI,CAAC,OAAO,CAAC,cAAc,EAAE,CAAC;QAC9B,OAAO,YAAY,CAAC,OAAO,EAAE,CAAC;IAChC,CAAC;CACF"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ActionResult } from "../action-result.js";
|
|
2
|
+
import { DirectoryPath } from "../../types/file/directoryPath.js";
|
|
3
|
+
import { CommandMetadata } from "../../types/common/command-metadata.js";
|
|
4
|
+
export declare class StatusAction {
|
|
5
|
+
private readonly configDir;
|
|
6
|
+
private readonly commandMetadata;
|
|
7
|
+
private readonly prompts;
|
|
8
|
+
private readonly apiService;
|
|
9
|
+
constructor(configDir: DirectoryPath, commandMetadata: CommandMetadata);
|
|
10
|
+
execute(authKey: string | null): Promise<ActionResult>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ActionResult } from "../action-result.js";
|
|
2
|
+
import { getAuthInfo } from "../../client-utils/auth-manager.js";
|
|
3
|
+
import { StatusPrompts } from "../../prompts/auth/status.js";
|
|
4
|
+
import { ApiService } from "../../infrastructure/services/api-service.js";
|
|
5
|
+
export class StatusAction {
|
|
6
|
+
constructor(configDir, commandMetadata) {
|
|
7
|
+
this.configDir = configDir;
|
|
8
|
+
this.commandMetadata = commandMetadata;
|
|
9
|
+
this.prompts = new StatusPrompts();
|
|
10
|
+
this.apiService = new ApiService();
|
|
11
|
+
}
|
|
12
|
+
async execute(authKey) {
|
|
13
|
+
const accountInfo = await getAuthInfo(this.configDir.toString());
|
|
14
|
+
if (accountInfo === null) {
|
|
15
|
+
return ActionResult.failed();
|
|
16
|
+
}
|
|
17
|
+
const result = await this.prompts.accountInfoSpinner(this.apiService.getAccountInfo(this.configDir, this.commandMetadata.shell, authKey));
|
|
18
|
+
if (result.isErr()) {
|
|
19
|
+
this.prompts.invalidKeyProvided(result.error);
|
|
20
|
+
return ActionResult.failed();
|
|
21
|
+
}
|
|
22
|
+
this.prompts.showAccountInfo(result.value);
|
|
23
|
+
return ActionResult.success();
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=status.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status.js","sourceRoot":"","sources":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DirectoryPath } from "../../types/file/directoryPath.js";
|
|
2
2
|
import { ActionResult } from "../action-result.js";
|
|
3
|
+
import { CommandMetadata } from "../../types/common/command-metadata.js";
|
|
3
4
|
export declare class CopilotAction {
|
|
4
5
|
private readonly apiService;
|
|
6
|
+
private readonly fileService;
|
|
7
|
+
private readonly launcherService;
|
|
5
8
|
private readonly prompts;
|
|
6
9
|
private readonly configDir;
|
|
10
|
+
private readonly commandMetadata;
|
|
7
11
|
private readonly authKey;
|
|
8
|
-
constructor(configDir: DirectoryPath, authKey?: string | null);
|
|
9
|
-
execute(buildDirectory: DirectoryPath, enable: boolean)
|
|
12
|
+
constructor(configDir: DirectoryPath, commandMetadata: CommandMetadata, authKey?: string | null);
|
|
13
|
+
readonly execute: (buildDirectory: DirectoryPath, force: boolean, enable: boolean) => Promise<ActionResult>;
|
|
10
14
|
private selectCopilotKey;
|
|
15
|
+
private prepareWelcomeMessage;
|
|
11
16
|
}
|
|
@@ -2,48 +2,88 @@ import { ApiService } from "../../infrastructure/services/api-service.js";
|
|
|
2
2
|
import { PortalCopilotPrompts } from "../../prompts/portal/copilot.js";
|
|
3
3
|
import { ActionResult } from "../action-result.js";
|
|
4
4
|
import { BuildContext } from "../../types/build-context.js";
|
|
5
|
+
import { withDirPath } from "../../infrastructure/tmp-extensions.js";
|
|
6
|
+
import { FilePath } from "../../types/file/filePath.js";
|
|
7
|
+
import { FileName } from "../../types/file/fileName.js";
|
|
8
|
+
import { FileService } from "../../infrastructure/file-service.js";
|
|
9
|
+
import { LauncherService } from "../../infrastructure/launcher-service.js";
|
|
10
|
+
import { err, ok } from "neverthrow";
|
|
5
11
|
export class CopilotAction {
|
|
6
|
-
constructor(configDir, authKey = null) {
|
|
12
|
+
constructor(configDir, commandMetadata, authKey = null) {
|
|
7
13
|
this.apiService = new ApiService();
|
|
14
|
+
this.fileService = new FileService();
|
|
15
|
+
this.launcherService = new LauncherService();
|
|
8
16
|
this.prompts = new PortalCopilotPrompts();
|
|
17
|
+
this.execute = async (buildDirectory, force, enable) => {
|
|
18
|
+
const buildContext = new BuildContext(buildDirectory);
|
|
19
|
+
if (!(await buildContext.validate())) {
|
|
20
|
+
this.prompts.srcDirectoryEmpty(buildDirectory);
|
|
21
|
+
return ActionResult.failed();
|
|
22
|
+
}
|
|
23
|
+
const buildJson = await buildContext.getBuildFileContents();
|
|
24
|
+
if (!force && buildJson.apiCopilotConfig != null && !(await this.prompts.confirmOverwrite())) {
|
|
25
|
+
this.prompts.cancelled();
|
|
26
|
+
return ActionResult.cancelled();
|
|
27
|
+
}
|
|
28
|
+
const response = await this.prompts.spinnerAccountInfo(this.apiService.getAccountInfo(this.configDir, this.commandMetadata.shell, this.authKey));
|
|
29
|
+
if (response.isErr()) {
|
|
30
|
+
this.prompts.serviceError(response.error);
|
|
31
|
+
return ActionResult.failed();
|
|
32
|
+
}
|
|
33
|
+
const apiCopilotKeyResult = await this.selectCopilotKey(response.value, force);
|
|
34
|
+
if (apiCopilotKeyResult.isErr()) {
|
|
35
|
+
if (apiCopilotKeyResult.error === "cancelled")
|
|
36
|
+
return ActionResult.cancelled();
|
|
37
|
+
return ActionResult.failed();
|
|
38
|
+
}
|
|
39
|
+
const welcomeMessage = await this.prepareWelcomeMessage();
|
|
40
|
+
buildJson.apiCopilotConfig = {
|
|
41
|
+
isEnabled: enable,
|
|
42
|
+
key: apiCopilotKeyResult.value,
|
|
43
|
+
welcomeMessage: welcomeMessage
|
|
44
|
+
};
|
|
45
|
+
await buildContext.updateBuildFileContents(buildJson);
|
|
46
|
+
this.prompts.copilotConfigured(enable, apiCopilotKeyResult.value);
|
|
47
|
+
return ActionResult.success();
|
|
48
|
+
};
|
|
9
49
|
this.configDir = configDir;
|
|
50
|
+
this.commandMetadata = commandMetadata;
|
|
10
51
|
this.authKey = authKey;
|
|
11
52
|
}
|
|
12
|
-
async
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
return
|
|
53
|
+
async selectCopilotKey(subscription, force) {
|
|
54
|
+
if (subscription.ApiCopilotKeys === undefined || subscription.ApiCopilotKeys.length === 0) {
|
|
55
|
+
this.prompts.noCopilotKeyFound();
|
|
56
|
+
return err("failed");
|
|
16
57
|
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
return ActionResult.error(response._unsafeUnwrapErr());
|
|
58
|
+
if (subscription.ApiCopilotKeys.length === 1) {
|
|
59
|
+
if (force || (await this.prompts.confirmSingleKeyUsage(subscription.ApiCopilotKeys[0])))
|
|
60
|
+
return ok(subscription.ApiCopilotKeys[0]);
|
|
61
|
+
this.prompts.noCopilotKeySelected();
|
|
62
|
+
return err("cancelled");
|
|
23
63
|
}
|
|
24
|
-
const
|
|
25
|
-
if (
|
|
26
|
-
|
|
64
|
+
const key = await this.prompts.selectCopilotKey(subscription.ApiCopilotKeys);
|
|
65
|
+
if (key === null) {
|
|
66
|
+
this.prompts.noCopilotKeySelected();
|
|
67
|
+
return err("cancelled");
|
|
27
68
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
return ActionResult.error("Exiting without making any change.");
|
|
31
|
-
buildJson.apiCopilotConfig = {
|
|
32
|
-
isEnabled: enable,
|
|
33
|
-
key: apiCopilotKey,
|
|
34
|
-
welcomeMessage: welcomeMessage
|
|
35
|
-
};
|
|
36
|
-
await buildContext.updateBuildFileContents(buildJson);
|
|
37
|
-
this.prompts.copilotConfigured(buildJson.apiCopilotConfig);
|
|
38
|
-
return ActionResult.success();
|
|
69
|
+
await this.prompts.displayApiCopilotKeyUsageWarning();
|
|
70
|
+
return ok(key);
|
|
39
71
|
}
|
|
40
|
-
async
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
72
|
+
async prepareWelcomeMessage() {
|
|
73
|
+
return await withDirPath(async (tempDir) => {
|
|
74
|
+
const tempFile = new FilePath(tempDir, new FileName("welcome-message.md"));
|
|
75
|
+
const defaultContent = "Hi there! I'm your API Integration Assistant, here to help you learn and integrate with this API.\n" +
|
|
76
|
+
"\n" +
|
|
77
|
+
"Ask me anything about this API or try one of these example prompts:\n" +
|
|
78
|
+
"\n" +
|
|
79
|
+
"`- What authentication methods does this API support?`\n" +
|
|
80
|
+
"`- [Enter another prompt here]`";
|
|
81
|
+
await this.fileService.writeContents(tempFile, defaultContent);
|
|
82
|
+
this.prompts.openWelcomeMessageEditor();
|
|
83
|
+
await this.launcherService.openInEditor(tempFile);
|
|
84
|
+
const welcomeMessage = await this.fileService.getContents(tempFile);
|
|
85
|
+
return welcomeMessage.replace(/\r\n|\r/g, "\n");
|
|
86
|
+
});
|
|
47
87
|
}
|
|
48
88
|
}
|
|
49
89
|
//# sourceMappingURL=copilot.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"copilot.js","sourceRoot":"","sources":["../../../src/actions/portal/copilot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,8CAA8C,CAAC;AAC1E,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AAEvE,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEnD,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"copilot.js","sourceRoot":"","sources":["../../../src/actions/portal/copilot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,8CAA8C,CAAC;AAC1E,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AAEvE,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEnD,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,wCAAwC,CAAC;AACrE,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AACxD,OAAO,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C;YACxC,MAAM,IAAI,CAAC,eAAe,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;YAClD,MAAM,cAAc,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;YACpE,OAAO,cAAc,CAAC,OAAO,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;QAClD,CAAC,CAAC,CAAC;IACL,CAAC;CACF"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { DirectoryPath } from "../../types/file/directoryPath.js";
|
|
2
2
|
import { ActionResult } from "../action-result.js";
|
|
3
|
+
import { CommandMetadata } from "../../types/common/command-metadata.js";
|
|
3
4
|
export declare class GenerateAction {
|
|
4
5
|
private readonly prompts;
|
|
5
|
-
private readonly
|
|
6
|
-
private readonly fileService;
|
|
6
|
+
private readonly launcherService;
|
|
7
7
|
private readonly portalService;
|
|
8
8
|
private readonly configDir;
|
|
9
|
+
private readonly commandMetadata;
|
|
9
10
|
private readonly authKey;
|
|
10
|
-
constructor(configDir: DirectoryPath, authKey?: string | null);
|
|
11
|
-
readonly execute: (buildDirectory: DirectoryPath, portalDirectory: DirectoryPath, force: boolean, zipPortal: boolean) => Promise<ActionResult>;
|
|
12
|
-
private parseError;
|
|
11
|
+
constructor(configDir: DirectoryPath, commandMetadata: CommandMetadata, authKey?: string | null);
|
|
12
|
+
readonly execute: (buildDirectory: DirectoryPath, portalDirectory: DirectoryPath, force: boolean, zipPortal: boolean, displayMessages?: boolean) => Promise<ActionResult>;
|
|
13
13
|
}
|
|
@@ -1,61 +1,59 @@
|
|
|
1
1
|
import { PortalGeneratePrompts } from "../../prompts/portal/generate.js";
|
|
2
|
-
import { ZipService } from "../../infrastructure/zip-service.js";
|
|
3
|
-
import { FileService } from "../../infrastructure/file-service.js";
|
|
4
2
|
import { PortalService } from "../../infrastructure/services/portal-service.js";
|
|
5
|
-
import { FilePath } from "../../types/file/filePath.js";
|
|
6
|
-
import { FileName } from "../../types/file/fileName.js";
|
|
7
3
|
import { ActionResult } from "../action-result.js";
|
|
8
4
|
import { BuildContext } from "../../types/build-context.js";
|
|
9
5
|
import { PortalContext } from "../../types/portal-context.js";
|
|
10
6
|
import { withDirPath } from "../../infrastructure/tmp-extensions.js";
|
|
7
|
+
import { LauncherService } from "../../infrastructure/launcher-service.js";
|
|
8
|
+
import { TempContext } from "../../types/temp-context.js";
|
|
11
9
|
export class GenerateAction {
|
|
12
|
-
constructor(configDir, authKey = null) {
|
|
10
|
+
constructor(configDir, commandMetadata, authKey = null) {
|
|
13
11
|
this.prompts = new PortalGeneratePrompts();
|
|
14
|
-
this.
|
|
15
|
-
this.fileService = new FileService();
|
|
12
|
+
this.launcherService = new LauncherService();
|
|
16
13
|
this.portalService = new PortalService();
|
|
17
|
-
this.execute = async (buildDirectory, portalDirectory, force, zipPortal) => {
|
|
14
|
+
this.execute = async (buildDirectory, portalDirectory, force, zipPortal, displayMessages = true) => {
|
|
18
15
|
if (buildDirectory.isEqual(portalDirectory)) {
|
|
19
|
-
|
|
16
|
+
this.prompts.directoryCannotBeSame(portalDirectory);
|
|
17
|
+
return ActionResult.failed();
|
|
20
18
|
}
|
|
21
19
|
const buildContext = new BuildContext(buildDirectory);
|
|
22
|
-
if (!await buildContext.validate()) {
|
|
23
|
-
|
|
20
|
+
if (!(await buildContext.validate())) {
|
|
21
|
+
this.prompts.srcDirectoryEmpty(buildDirectory);
|
|
22
|
+
return ActionResult.failed();
|
|
24
23
|
}
|
|
25
24
|
const portalContext = new PortalContext(portalDirectory);
|
|
26
25
|
if (!force && (await portalContext.exists()) && !(await this.prompts.overwritePortal(portalDirectory))) {
|
|
27
|
-
|
|
26
|
+
this.prompts.portalDirectoryNotEmpty();
|
|
27
|
+
return ActionResult.cancelled();
|
|
28
28
|
}
|
|
29
29
|
return await withDirPath(async (tempDirectory) => {
|
|
30
|
-
|
|
31
|
-
const buildZipPath =
|
|
32
|
-
await this.
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
30
|
+
const tempContext = new TempContext(tempDirectory);
|
|
31
|
+
const buildZipPath = await tempContext.zip(buildDirectory);
|
|
32
|
+
const response = await this.prompts.generatePortal(this.portalService.generatePortal(buildZipPath, this.configDir, this.commandMetadata, this.authKey));
|
|
33
|
+
if (response.isErr()) {
|
|
34
|
+
const error = response.error;
|
|
35
|
+
if (typeof error === "string") {
|
|
36
|
+
this.prompts.portalGenerationError(error);
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
const errorZipPath = await tempContext.save(error);
|
|
40
|
+
const reportPath = await portalContext.saveError(errorZipPath);
|
|
41
|
+
await this.launcherService.openFile(reportPath);
|
|
42
|
+
this.prompts.portalGenerationErrorWithReport(reportPath);
|
|
43
|
+
}
|
|
44
|
+
return ActionResult.failed();
|
|
45
|
+
}
|
|
46
|
+
const tempPortalZipPath = await tempContext.save(response.value);
|
|
47
|
+
await portalContext.save(tempPortalZipPath, zipPortal);
|
|
48
|
+
if (displayMessages) {
|
|
49
|
+
this.prompts.portalGenerated(portalDirectory);
|
|
37
50
|
}
|
|
38
|
-
const tempPortalFilePath = new FilePath(tempDirectory, new FileName("portal.zip"));
|
|
39
|
-
await this.fileService.writeFile(tempPortalFilePath, response.value);
|
|
40
|
-
await portalContext.save(tempPortalFilePath, zipPortal);
|
|
41
|
-
this.prompts.displayPortalGenerationSuccessMessage();
|
|
42
51
|
return ActionResult.success();
|
|
43
52
|
});
|
|
44
53
|
};
|
|
45
54
|
this.configDir = configDir;
|
|
55
|
+
this.commandMetadata = commandMetadata;
|
|
46
56
|
this.authKey = authKey;
|
|
47
57
|
}
|
|
48
|
-
async parseError(error, portalDirectory, tempDirectory) {
|
|
49
|
-
if (typeof error === 'string') {
|
|
50
|
-
return error;
|
|
51
|
-
}
|
|
52
|
-
const tempErrorFilePath = new FilePath(tempDirectory, new FileName("error.zip"));
|
|
53
|
-
await this.fileService.writeFile(tempErrorFilePath, error);
|
|
54
|
-
await this.fileService.cleanDirectory(portalDirectory);
|
|
55
|
-
await this.zipArchiver.unArchive(tempErrorFilePath, portalDirectory);
|
|
56
|
-
const errorReportPath = portalDirectory.join("apimatic-debug");
|
|
57
|
-
return "An error occurred during portal generation due to an issue with the input. An error report has been written at the destination path: " +
|
|
58
|
-
errorReportPath;
|
|
59
|
-
}
|
|
60
58
|
}
|
|
61
59
|
//# sourceMappingURL=generate.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate.js","sourceRoot":"","sources":["../../../src/actions/portal/generate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"generate.js","sourceRoot":"","sources":["../../../src/actions/portal/generate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,EAAE,aAAa,EAAE,MAAM,iDAAiD,CAAC;AAEhF,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,wCAAwC,CAAC;AACrE,OAAO,EAAE,eAAe,EAAE,MAAM,0CAA0C,CAAC;AAC3E,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAG1D,MAAM,OAAO,cAAc;IAQzB,YAAY,SAAwB,EAAE,eAAgC,EAAE,UAAyB,IAAI;QAPpF,YAAO,GAA0B,IAAI,qBAAqB,EAAE,CAAC;QAC7D,oBAAe,GAAoB,IAAI,eAAe,EAAE,CAAC;QACzD,kBAAa,GAAkB,IAAI,aAAa,EAAE,CAAC;QAWpD,YAAO,GAAG,KAAK,EAC7B,cAA6B,EAC7B,eAA8B,EAC9B,KAAc,EACd,SAAkB,EAClB,kBAA2B,IAAI,EACR,EAAE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GAAG,QAAQ,CAAC,KAAK,CAAC;oBAC7B,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;wBAC9B,IAAI,CAAC,OAAO,CAAC,qBAAqB,CAAC,KAAK,CAAC,CAAC;oBAC5C,CAAC;yBAAM,CAAC;wBACN,MAAM,YAAY,GAAG,MAAM,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;wBACnD,MAAM,UAAU,GAAG,MAAM,aAAa,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;wBAC/D,MAAM,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;wBAChD,IAAI,CAAC,OAAO,CAAC,+BAA+B,CAAC,UAAU,CAAC,CAAC;oBAC3D,CAAC;oBACD,OAAO,YAAY,CAAC,MAAM,EAAE,CAAC;gBAC/B,CAAC;gBAED,MAAM,iBAAiB,GAAG,MAAM,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;gBACjE,MAAM,aAAa,CAAC,IAAI,CAAC,iBAAiB,EAAE,SAAS,CAAC,CAAC;gBAEvD,IAAI,eAAe,EAAE,CAAC;oBACpB,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,eAAe,CAAC,CAAC;gBAChD,CAAC;gBAED,OAAO,YAAY,CAAC,OAAO,EAAE,CAAC;YAChC,CAAC,CAAC,CAAC;QACL,CAAC,CAAC;QA3DA,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;QACvC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;CAyDF"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { DirectoryPath } from "../../types/file/directoryPath.js";
|
|
2
|
+
import { ActionResult } from "../action-result.js";
|
|
3
|
+
import { CommandMetadata } from "../../types/common/command-metadata.js";
|
|
4
|
+
export declare class PortalQuickstartAction {
|
|
5
|
+
private readonly prompts;
|
|
6
|
+
private readonly zipService;
|
|
7
|
+
private readonly fileService;
|
|
8
|
+
private readonly configDir;
|
|
9
|
+
private readonly commandMetadata;
|
|
10
|
+
private readonly fileDownloadService;
|
|
11
|
+
private readonly buildFileUrl;
|
|
12
|
+
private readonly defaultSpecUrl;
|
|
13
|
+
private readonly repositoryFolderName;
|
|
14
|
+
constructor(configDir: DirectoryPath, commandMetadata: CommandMetadata);
|
|
15
|
+
readonly execute: () => Promise<ActionResult>;
|
|
16
|
+
}
|