@apimatic/cli 1.1.0-alpha.2 → 1.1.0-alpha.21
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 +257 -101
- package/bin/run.js +5 -0
- package/lib/actions/action-result.d.ts +8 -0
- package/lib/actions/action-result.js +25 -0
- package/lib/actions/action-result.js.map +1 -0
- package/lib/actions/auth/login.d.ts +12 -0
- package/lib/actions/auth/login.js +63 -0
- package/lib/actions/auth/login.js.map +1 -0
- package/lib/actions/portal/copilot.d.ts +14 -0
- package/lib/actions/portal/copilot.js +79 -0
- package/lib/actions/portal/copilot.js.map +1 -0
- package/lib/actions/portal/generate.d.ts +14 -0
- package/lib/actions/portal/generate.js +66 -0
- package/lib/actions/portal/generate.js.map +1 -0
- package/lib/actions/portal/recipe/new-recipe.d.ts +24 -0
- package/lib/actions/portal/recipe/new-recipe.js +250 -0
- package/lib/actions/portal/recipe/new-recipe.js.map +1 -0
- package/lib/actions/portal/serve.d.ts +14 -0
- package/lib/actions/portal/serve.js +24 -0
- package/lib/actions/portal/serve.js.map +1 -0
- package/lib/actions/portal/toc/new-toc.d.ts +20 -0
- package/lib/actions/portal/toc/new-toc.js +133 -0
- package/lib/actions/portal/toc/new-toc.js.map +1 -0
- package/lib/actions/sdk/generate.d.ts +14 -0
- package/lib/actions/sdk/generate.js +72 -0
- package/lib/actions/sdk/generate.js.map +1 -0
- package/lib/application/portal/recipe/portal-recipe.d.ts +8 -0
- package/lib/application/portal/recipe/portal-recipe.js +33 -0
- package/lib/application/portal/recipe/portal-recipe.js.map +1 -0
- package/lib/application/portal/recipe/recipe-generator.d.ts +16 -0
- package/lib/application/portal/recipe/recipe-generator.js +147 -0
- package/lib/application/portal/recipe/recipe-generator.js.map +1 -0
- package/lib/application/portal/serve/portal-watcher.d.ts +11 -0
- package/lib/application/portal/serve/portal-watcher.js +64 -0
- package/lib/application/portal/serve/portal-watcher.js.map +1 -0
- package/lib/application/portal/serve/serve-handler.d.ts +16 -0
- package/lib/application/portal/serve/serve-handler.js +91 -0
- package/lib/application/portal/serve/serve-handler.js.map +1 -0
- package/lib/application/portal/serve/watcher-handler.d.ts +10 -0
- package/lib/application/portal/serve/watcher-handler.js +51 -0
- package/lib/application/portal/serve/watcher-handler.js.map +1 -0
- package/lib/application/portal/toc/sdl-parser.d.ts +19 -0
- package/lib/application/portal/toc/sdl-parser.js +90 -0
- package/lib/application/portal/toc/sdl-parser.js.map +1 -0
- package/lib/application/portal/toc/toc-content-parser.d.ts +5 -0
- package/lib/application/portal/toc/toc-content-parser.js +44 -0
- package/lib/application/portal/toc/toc-content-parser.js.map +1 -0
- package/lib/application/portal/toc/toc-structure-generator.d.ts +6 -0
- package/lib/application/portal/toc/toc-structure-generator.js +84 -0
- package/lib/application/portal/toc/toc-structure-generator.js.map +1 -0
- package/lib/client-utils/auth-manager.d.ts +8 -3
- package/lib/client-utils/auth-manager.js +23 -10
- package/lib/client-utils/auth-manager.js.map +1 -0
- package/lib/client-utils/sdk-client.d.ts +4 -9
- package/lib/client-utils/sdk-client.js +9 -87
- package/lib/client-utils/sdk-client.js.map +1 -0
- package/lib/commands/api/transform.d.ts +7 -7
- package/lib/commands/api/transform.js +46 -51
- package/lib/commands/api/transform.js.map +1 -0
- package/lib/commands/api/validate.d.ts +4 -4
- package/lib/commands/api/validate.js +35 -36
- package/lib/commands/api/validate.js.map +1 -0
- package/lib/commands/auth/login.d.ts +3 -2
- package/lib/commands/auth/login.js +22 -53
- package/lib/commands/auth/login.js.map +1 -0
- package/lib/commands/auth/logout.d.ts +1 -1
- package/lib/commands/auth/logout.js +8 -13
- package/lib/commands/auth/logout.js.map +1 -0
- package/lib/commands/auth/status.d.ts +1 -1
- package/lib/commands/auth/status.js +9 -13
- package/lib/commands/auth/status.js.map +1 -0
- package/lib/commands/portal/copilot.d.ts +13 -0
- package/lib/commands/portal/copilot.js +32 -0
- package/lib/commands/portal/copilot.js.map +1 -0
- package/lib/commands/portal/generate.d.ts +10 -8
- package/lib/commands/portal/generate.js +28 -107
- package/lib/commands/portal/generate.js.map +1 -0
- package/lib/commands/portal/quickstart.d.ts +10 -0
- package/lib/commands/portal/quickstart.js +114 -0
- package/lib/commands/portal/quickstart.js.map +1 -0
- package/lib/commands/portal/recipe/new.d.ts +10 -0
- package/lib/commands/portal/recipe/new.js +38 -0
- package/lib/commands/portal/recipe/new.js.map +1 -0
- package/lib/commands/portal/serve.d.ts +16 -0
- package/lib/commands/portal/serve.js +80 -0
- package/lib/commands/portal/serve.js.map +1 -0
- package/lib/commands/portal/toc/new.d.ts +14 -0
- package/lib/commands/portal/toc/new.js +52 -0
- package/lib/commands/portal/toc/new.js.map +1 -0
- package/lib/commands/sdk/generate.d.ts +9 -8
- package/lib/commands/sdk/generate.js +39 -128
- package/lib/commands/sdk/generate.js.map +1 -0
- package/lib/config/axios-config.d.ts +2 -0
- package/lib/config/axios-config.js +10 -0
- package/lib/config/axios-config.js.map +1 -0
- package/lib/config/env.d.ts +26 -1
- package/lib/config/env.js +27 -4
- package/lib/config/env.js.map +1 -0
- package/lib/controllers/api/transform.d.ts +1 -1
- package/lib/controllers/api/transform.js +23 -22
- package/lib/controllers/api/transform.js.map +1 -0
- package/lib/controllers/api/validate.d.ts +3 -3
- package/lib/controllers/api/validate.js +19 -12
- package/lib/controllers/api/validate.js.map +1 -0
- package/lib/controllers/portal/quickstart.d.ts +13 -0
- package/lib/controllers/portal/quickstart.js +214 -0
- package/lib/controllers/portal/quickstart.js.map +1 -0
- 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/index.d.ts +1 -1
- package/lib/index.js +2 -4
- package/lib/index.js.map +1 -0
- package/lib/infrastructure/api-client-utils.d.ts +6 -0
- package/lib/infrastructure/api-client-utils.js +34 -0
- package/lib/infrastructure/api-client-utils.js.map +1 -0
- package/lib/infrastructure/api-utils.d.ts +9 -0
- package/lib/infrastructure/api-utils.js +33 -0
- package/lib/infrastructure/api-utils.js.map +1 -0
- package/lib/infrastructure/env-info.d.ts +12 -0
- package/lib/infrastructure/env-info.js +58 -0
- package/lib/infrastructure/env-info.js.map +1 -0
- package/lib/infrastructure/file-service.d.ts +18 -0
- package/lib/infrastructure/file-service.js +76 -0
- package/lib/infrastructure/file-service.js.map +1 -0
- package/lib/infrastructure/launcher-service.d.ts +5 -0
- package/lib/infrastructure/launcher-service.js +47 -0
- package/lib/infrastructure/launcher-service.js.map +1 -0
- package/lib/infrastructure/services/api-service.d.ts +10 -0
- package/lib/infrastructure/services/api-service.js +55 -0
- package/lib/infrastructure/services/api-service.js.map +1 -0
- package/lib/infrastructure/services/auth-service.d.ts +11 -0
- package/lib/infrastructure/services/auth-service.js +35 -0
- package/lib/infrastructure/services/auth-service.js.map +1 -0
- package/lib/infrastructure/services/portal-service.d.ts +23 -0
- package/lib/infrastructure/services/portal-service.js +186 -0
- package/lib/infrastructure/services/portal-service.js.map +1 -0
- package/lib/infrastructure/services/telemetry-service.d.ts +8 -0
- package/lib/infrastructure/services/telemetry-service.js +40 -0
- package/lib/infrastructure/services/telemetry-service.js.map +1 -0
- package/lib/infrastructure/tmp-extensions.d.ts +2 -0
- package/lib/infrastructure/tmp-extensions.js +6 -0
- package/lib/infrastructure/tmp-extensions.js.map +1 -0
- package/lib/infrastructure/zip-service.d.ts +6 -0
- package/lib/infrastructure/zip-service.js +39 -0
- package/lib/infrastructure/zip-service.js.map +1 -0
- package/lib/prompts/auth/login.d.ts +5 -0
- package/lib/prompts/auth/login.js +13 -0
- package/lib/prompts/auth/login.js.map +1 -0
- package/lib/prompts/portal/common/base-prompts.d.ts +7 -0
- package/lib/prompts/portal/common/base-prompts.js +19 -0
- package/lib/prompts/portal/common/base-prompts.js.map +1 -0
- package/lib/prompts/portal/copilot.d.ts +14 -0
- package/lib/prompts/portal/copilot.js +71 -0
- package/lib/prompts/portal/copilot.js.map +1 -0
- package/lib/prompts/portal/generate.d.ts +11 -0
- package/lib/prompts/portal/generate.js +42 -0
- package/lib/prompts/portal/generate.js.map +1 -0
- package/lib/prompts/portal/quickstart.d.ts +30 -0
- package/lib/prompts/portal/quickstart.js +240 -0
- package/lib/prompts/portal/quickstart.js.map +1 -0
- package/lib/prompts/portal/recipe/new-recipe.d.ts +24 -0
- package/lib/prompts/portal/recipe/new-recipe.js +203 -0
- package/lib/prompts/portal/recipe/new-recipe.js.map +1 -0
- package/lib/prompts/portal/serve.d.ts +4 -0
- package/lib/prompts/portal/serve.js +14 -0
- package/lib/prompts/portal/serve.js.map +1 -0
- package/lib/prompts/portal/toc/new-toc.d.ts +11 -0
- package/lib/prompts/portal/toc/new-toc.js +39 -0
- package/lib/prompts/portal/toc/new-toc.js.map +1 -0
- package/lib/prompts/sdk/generate.d.ts +11 -0
- package/lib/prompts/sdk/generate.js +42 -0
- package/lib/prompts/sdk/generate.js.map +1 -0
- package/lib/types/api/account.d.ts +10 -0
- package/lib/types/api/account.js +2 -0
- package/lib/types/api/account.js.map +1 -0
- package/lib/types/api/transform.d.ts +19 -4
- package/lib/types/api/transform.js +19 -4
- package/lib/types/api/transform.js.map +1 -0
- package/lib/types/api/validate.d.ts +3 -3
- package/lib/types/api/validate.js +2 -2
- package/lib/types/api/validate.js.map +1 -0
- package/lib/types/build/build.d.ts +14 -0
- package/lib/types/build/build.js +4 -0
- package/lib/types/build/build.js.map +1 -0
- package/lib/types/build-context.d.ts +13 -0
- package/lib/types/build-context.js +30 -0
- package/lib/types/build-context.js.map +1 -0
- package/lib/types/common/result.d.ts +17 -0
- package/lib/types/common/result.js +32 -0
- package/lib/types/common/result.js.map +1 -0
- package/lib/types/events/domain-event.d.ts +8 -0
- package/lib/types/events/domain-event.js +11 -0
- package/lib/types/events/domain-event.js.map +1 -0
- 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 +5 -0
- package/lib/types/events/recipe-creation-failed.js +8 -0
- package/lib/types/events/recipe-creation-failed.js.map +1 -0
- package/lib/types/events/toc-creation-failed.d.ts +5 -0
- package/lib/types/events/toc-creation-failed.js +8 -0
- package/lib/types/events/toc-creation-failed.js.map +1 -0
- package/lib/types/file/directoryPath.d.ts +7 -0
- package/lib/types/file/directoryPath.js +16 -0
- package/lib/types/file/directoryPath.js.map +1 -0
- package/lib/types/file/fileName.d.ts +5 -0
- package/lib/types/file/fileName.js +9 -0
- package/lib/types/file/fileName.js.map +1 -0
- package/lib/types/file/filePath.d.ts +8 -0
- package/lib/types/file/filePath.js +11 -0
- package/lib/types/file/filePath.js.map +1 -0
- package/lib/types/flags-provider.d.ts +15 -0
- package/lib/types/flags-provider.js +34 -0
- package/lib/types/flags-provider.js.map +1 -0
- package/lib/types/portal/generate.d.ts +13 -9
- package/lib/types/portal/generate.js +3 -2
- package/lib/types/portal/generate.js.map +1 -0
- package/lib/types/portal/quickstart.d.ts +17 -0
- package/lib/types/portal/quickstart.js +2 -0
- package/lib/types/portal/quickstart.js.map +1 -0
- package/lib/types/portal/serve.d.ts +12 -0
- package/lib/types/portal/serve.js +2 -0
- package/lib/types/portal/serve.js.map +1 -0
- package/lib/types/portal-context.d.ts +11 -0
- package/lib/types/portal-context.js +28 -0
- package/lib/types/portal-context.js.map +1 -0
- package/lib/types/recipe/recipe.d.ts +37 -0
- package/lib/types/recipe/recipe.js +6 -0
- package/lib/types/recipe/recipe.js.map +1 -0
- package/lib/types/sdk/generate.d.ts +11 -10
- package/lib/types/sdk/generate.js +11 -12
- package/lib/types/sdk/generate.js.map +1 -0
- package/lib/types/sdk-context.d.ts +13 -0
- package/lib/types/sdk-context.js +28 -0
- package/lib/types/sdk-context.js.map +1 -0
- package/lib/types/sdl/sdl.d.ts +12 -0
- package/lib/types/sdl/sdl.js +2 -0
- package/lib/types/sdl/sdl.js.map +1 -0
- package/lib/types/spec-context.d.ts +7 -0
- package/lib/types/spec-context.js +12 -0
- package/lib/types/spec-context.js.map +1 -0
- package/lib/types/toc/toc.d.ts +31 -0
- package/lib/types/toc/toc.js +9 -0
- package/lib/types/toc/toc.js.map +1 -0
- package/lib/types/utils.d.ts +3 -3
- package/lib/types/utils.js +2 -2
- package/lib/types/utils.js.map +1 -0
- package/lib/utils/utils.d.ts +16 -7
- package/lib/utils/utils.js +142 -86
- package/lib/utils/utils.js.map +1 -0
- package/lib/validators/common/directoryValidator.d.ts +5 -0
- package/lib/validators/common/directoryValidator.js +22 -0
- package/lib/validators/common/directoryValidator.js.map +1 -0
- package/lib/validators/portal/serve-validator.d.ts +6 -0
- package/lib/validators/portal/serve-validator.js +15 -0
- package/lib/validators/portal/serve-validator.js.map +1 -0
- package/package.json +100 -43
- package/bin/run +0 -5
- package/lib/controllers/portal/generate.d.ts +0 -2
- package/lib/controllers/portal/generate.js +0 -49
- package/lib/controllers/sdk/generate.d.ts +0 -4
- package/lib/controllers/sdk/generate.js +0 -64
|
@@ -1,135 +1,46 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
import { Command, Flags } from "@oclif/core";
|
|
2
|
+
import { DirectoryPath } from "../../types/file/directoryPath.js";
|
|
3
|
+
import { FlagsProvider } from "../../types/flags-provider.js";
|
|
4
|
+
import { SdkGeneratePrompts } from "../../prompts/sdk/generate.js";
|
|
5
|
+
import { GenerateAction } from "../../actions/sdk/generate.js";
|
|
6
|
+
import { LanguagePlatform } from "../../types/sdk/generate.js";
|
|
7
|
+
const DEFAULT_WORKING_DIRECTORY = "./";
|
|
8
|
+
class SdkGenerate extends Command {
|
|
9
|
+
constructor() {
|
|
10
|
+
super(...arguments);
|
|
11
|
+
this.prompts = new SdkGeneratePrompts();
|
|
12
|
+
this.getConfigDir = () => {
|
|
13
|
+
return new DirectoryPath(this.config.configDir);
|
|
14
|
+
};
|
|
15
|
+
}
|
|
11
16
|
async run() {
|
|
12
|
-
const { flags } = this.parse(SdkGenerate);
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
throw new Error(`Can't download SDK to path ${sdkFolderPath}, because it already exists`);
|
|
20
|
-
}
|
|
21
|
-
else if (fs.existsSync(zippedSDKPath) && !flags.force && zip) {
|
|
22
|
-
throw new Error(`Can't download SDK to path ${zippedSDKPath}, because it already exists`);
|
|
23
|
-
}
|
|
24
|
-
try {
|
|
25
|
-
if (!(await fs.pathExists(path.resolve(flags.destination)))) {
|
|
26
|
-
throw new Error(`Destination path ${flags.destination} does not exist`);
|
|
27
|
-
}
|
|
28
|
-
else if (!(await fs.pathExists(path.resolve(flags.file)))) {
|
|
29
|
-
throw new Error(`Specification file ${flags.file} does not exist`);
|
|
30
|
-
}
|
|
31
|
-
const overrideAuthKey = flags["auth-key"] ? flags["auth-key"] : null;
|
|
32
|
-
const client = await sdk_client_1.SDKClient.getInstance().getClient(overrideAuthKey, this.config.configDir);
|
|
33
|
-
const sdkGenerationController = new sdk_1.CodeGenerationExternalApisController(client);
|
|
34
|
-
// Get generation id for the specification and platform
|
|
35
|
-
const codeGenId = await generate_1.getSDKGenerationId(flags, sdkGenerationController);
|
|
36
|
-
// If user wanted to download the SDK as well
|
|
37
|
-
const sdkDownloadParams = {
|
|
38
|
-
codeGenId,
|
|
39
|
-
zippedSDKPath,
|
|
40
|
-
sdkFolderPath,
|
|
41
|
-
zip
|
|
42
|
-
};
|
|
43
|
-
const sdkPath = await generate_1.downloadGeneratedSDK(sdkDownloadParams, sdkGenerationController);
|
|
44
|
-
this.log(`Success! Your SDK is located at ${sdkPath}`);
|
|
45
|
-
}
|
|
46
|
-
catch (error) {
|
|
47
|
-
if (error.result) {
|
|
48
|
-
const apiError = error;
|
|
49
|
-
const result = apiError.result;
|
|
50
|
-
if (apiError.statusCode === 400 && utils_1.isJSONParsable(result.message)) {
|
|
51
|
-
const errors = JSON.parse(result.message);
|
|
52
|
-
if (Array.isArray(errors.Errors) && apiError.statusCode === 400) {
|
|
53
|
-
this.error(utils_1.replaceHTML(`${JSON.parse(result.message).Errors[0]}`));
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
else if (apiError.statusCode === 401 && apiError.body && typeof apiError.body === "string") {
|
|
57
|
-
this.error("You are not authorized to perform this action");
|
|
58
|
-
}
|
|
59
|
-
else if (apiError.statusCode === 500 &&
|
|
60
|
-
apiError.body &&
|
|
61
|
-
typeof apiError.body === "string" &&
|
|
62
|
-
utils_1.isJSONParsable(apiError.body)) {
|
|
63
|
-
this.error(JSON.parse(apiError.body).message);
|
|
64
|
-
}
|
|
65
|
-
else if (apiError.statusCode === 422 &&
|
|
66
|
-
apiError.body &&
|
|
67
|
-
typeof apiError.body === "string" &&
|
|
68
|
-
utils_1.isJSONParsable(apiError.body)) {
|
|
69
|
-
this.error(JSON.parse(apiError.body)["dto.Url"][0]);
|
|
70
|
-
}
|
|
71
|
-
else {
|
|
72
|
-
this.error(utils_1.replaceHTML(result.message));
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
else if (error.statusCode === 401) {
|
|
76
|
-
this.error("You are not authorized to perform this action");
|
|
77
|
-
}
|
|
78
|
-
else if (error.statusCode === 402 &&
|
|
79
|
-
error.body &&
|
|
80
|
-
typeof error.body === "string") {
|
|
81
|
-
this.error(utils_1.replaceHTML(error.body));
|
|
82
|
-
}
|
|
83
|
-
else {
|
|
84
|
-
this.error(`${error.message}`);
|
|
85
|
-
}
|
|
86
|
-
}
|
|
17
|
+
const { flags: { platform, spec, destination, force, zip: zipSdk, "auth-key": authKey } } = await this.parse(SdkGenerate);
|
|
18
|
+
const workingDirectory = new DirectoryPath(DEFAULT_WORKING_DIRECTORY);
|
|
19
|
+
const specDirectory = new DirectoryPath(spec);
|
|
20
|
+
const sdkDirectory = destination ? new DirectoryPath(destination) : workingDirectory.join("sdk").join(platform);
|
|
21
|
+
var action = new GenerateAction(this.getConfigDir(), authKey);
|
|
22
|
+
const result = await action.execute(specDirectory, sdkDirectory, platform, SdkGenerate.id, force, zipSdk);
|
|
23
|
+
result.mapAll(() => this.prompts.displayOutroMessage(sdkDirectory), (message) => this.prompts.logError(message));
|
|
87
24
|
}
|
|
88
25
|
}
|
|
89
|
-
|
|
90
|
-
SdkGenerate.
|
|
91
|
-
SdkGenerate.flags = {
|
|
92
|
-
platform: command_1.flags.string({
|
|
93
|
-
parse: (input) => input.toUpperCase(),
|
|
26
|
+
SdkGenerate.description = "Generate an SDK for your API";
|
|
27
|
+
SdkGenerate.flags = Object.assign(Object.assign(Object.assign({ platform: Flags.string({
|
|
94
28
|
required: true,
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
description:
|
|
103
|
-
}),
|
|
104
|
-
url: command_1.flags.string({
|
|
105
|
-
default: "",
|
|
106
|
-
description: "URL to the API specification to generate SDKs for. Can be used in place of the --file option if the API specification is publicly available."
|
|
107
|
-
}),
|
|
108
|
-
destination: command_1.flags.string({
|
|
109
|
-
parse: (input) => path.resolve(input),
|
|
110
|
-
default: path.resolve("./"),
|
|
111
|
-
description: "directory to download the generated SDK to"
|
|
112
|
-
}),
|
|
113
|
-
force: command_1.flags.boolean({
|
|
114
|
-
char: "f",
|
|
29
|
+
options: Object.values(LanguagePlatform).map((p) => p.toString()),
|
|
30
|
+
description: `language platform for sdk`
|
|
31
|
+
}), spec: Flags.string({
|
|
32
|
+
description: "path to the folder containing the API specification file.",
|
|
33
|
+
default: "./src/spec"
|
|
34
|
+
}), destination: Flags.string({
|
|
35
|
+
char: "d",
|
|
36
|
+
description: `[default: ./sdk/<platform>] path where the sdk will be generated.`
|
|
37
|
+
}) }, FlagsProvider.force), { zip: Flags.boolean({
|
|
115
38
|
default: false,
|
|
116
|
-
description: "
|
|
117
|
-
}),
|
|
118
|
-
zip: command_1.flags.boolean({ default: false, description: "download the generated SDK as a .zip archive" }),
|
|
119
|
-
"auth-key": command_1.flags.string({
|
|
120
|
-
default: "",
|
|
121
|
-
description: "override current authentication state with an authentication key"
|
|
122
|
-
})
|
|
123
|
-
};
|
|
39
|
+
description: "download the generated SDK as a .zip archive"
|
|
40
|
+
}) }), FlagsProvider.authKey);
|
|
124
41
|
SdkGenerate.examples = [
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
Downloading SDK... done
|
|
128
|
-
Success! Your SDK is located at swagger_sdk_csharp`,
|
|
129
|
-
`
|
|
130
|
-
$ apimatic sdk:generate --platform="CSHARP" --url=https://petstore.swagger.io/v2/swagger.json
|
|
131
|
-
Generating SDK... done
|
|
132
|
-
Downloading SDK... done
|
|
133
|
-
Success! Your SDK is located at swagger_sdk_csharp
|
|
134
|
-
`
|
|
42
|
+
`apimatic sdk:generate --platform=java`,
|
|
43
|
+
`apimatic sdk:generate --platform=csharp --spec="./src/spec"`
|
|
135
44
|
];
|
|
45
|
+
export default SdkGenerate;
|
|
46
|
+
//# sourceMappingURL=generate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate.js","sourceRoot":"","sources":["../../../src/commands/sdk/generate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAClE,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAE/D,MAAM,yBAAyB,GAAG,IAAI,CAAC;AAEvC,MAAqB,WAAY,SAAQ,OAAO;IAAhD;;QA6BmB,YAAO,GAAuB,IAAI,kBAAkB,EAAE,CAAC;QAoBhE,iBAAY,GAAG,GAAG,EAAE;YAC1B,OAAO,IAAI,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;QAClD,CAAC,CAAC;IACJ,CAAC;IArBC,KAAK,CAAC,GAAG;QACP,MAAM,EACJ,KAAK,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,EAChF,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;QAElC,MAAM,gBAAgB,GAAG,IAAI,aAAa,CAAC,yBAAyB,CAAC,CAAC;QACtE,MAAM,aAAa,GAAG,IAAI,aAAa,CAAC,IAAI,CAAC,CAAC;QAE9C,MAAM,YAAY,GAAG,WAAW,CAAC,CAAC,CAAC,IAAI,aAAa,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,gBAAgB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAEhH,IAAI,MAAM,GAAG,IAAI,cAAc,CAAC,IAAI,CAAC,YAAY,EAAE,EAAE,OAAO,CAAC,CAAC;QAC9D,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC,aAAa,EAAE,YAAY,EAAE,QAA4B,EAAE,WAAW,CAAC,EAAE,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;QAC9H,MAAM,CAAC,MAAM,CACX,GAAG,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,mBAAmB,CAAC,YAAY,CAAC,EACpD,CAAC,OAAO,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,CAC5C,CAAC;IACJ,CAAC;;AA9CM,uBAAW,GAAG,8BAA8B,AAAjC,CAAkC;AAC7C,iBAAK,+CACV,QAAQ,EAAE,KAAK,CAAC,MAAM,CAAC;QACrB,QAAQ,EAAE,IAAI;QACd,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;QACjE,WAAW,EAAE,2BAA2B;KACzC,CAAC,EACF,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC;QACjB,WAAW,EAAE,2DAA2D;QACxE,OAAO,EAAE,YAAY;KACtB,CAAC,EACF,WAAW,EAAE,KAAK,CAAC,MAAM,CAAC;QACxB,IAAI,EAAE,GAAG;QACT,WAAW,EAAE,mEAAmE;KACjF,CAAC,IACC,aAAa,CAAC,KAAK,KACtB,GAAG,EAAE,KAAK,CAAC,OAAO,CAAC;QACjB,OAAO,EAAE,KAAK;QACd,WAAW,EAAE,8CAA8C;KAC5D,CAAC,KACC,aAAa,CAAC,OAAO,CAnBd,CAoBV;AAEK,oBAAQ,GAAG;IAChB,uCAAuC;IACvC,6DAA6D;CAC9D,AAHc,CAGb;eA3BiB,WAAW"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import axios from "axios";
|
|
2
|
+
const fiftyMBsInBytes = 50 * 1024 * 1024;
|
|
3
|
+
const fiveMinutesInMilliseconds = 5 * 60 * 1000;
|
|
4
|
+
const axiosInstance = axios.create({
|
|
5
|
+
maxContentLength: fiftyMBsInBytes,
|
|
6
|
+
maxBodyLength: fiftyMBsInBytes,
|
|
7
|
+
timeout: fiveMinutesInMilliseconds
|
|
8
|
+
});
|
|
9
|
+
export default axiosInstance;
|
|
10
|
+
//# sourceMappingURL=axios-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"axios-config.js","sourceRoot":"","sources":["../../src/config/axios-config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,eAAe,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC;AACzC,MAAM,yBAAyB,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC;AAEhD,MAAM,aAAa,GAAG,KAAK,CAAC,MAAM,CAAC;IACjC,gBAAgB,EAAE,eAAe;IACjC,aAAa,EAAE,eAAe;IAC9B,OAAO,EAAE,yBAAyB;CACnC,CAAC,CAAC;AAEH,eAAe,aAAa,CAAC"}
|
package/lib/config/env.d.ts
CHANGED
|
@@ -1 +1,26 @@
|
|
|
1
|
-
export declare const baseURL = "https://
|
|
1
|
+
export declare const baseURL = "https://api.apimatic.io";
|
|
2
|
+
export declare const metadataFileContent: {
|
|
3
|
+
ImportSettings: {
|
|
4
|
+
AutoGenerateTestCases: boolean;
|
|
5
|
+
ImportAdditionalHeader: boolean;
|
|
6
|
+
ImportAdditionalTypeCombinatorModels: boolean;
|
|
7
|
+
ImportTypeCombinatorsWithOnlyOneType: boolean;
|
|
8
|
+
};
|
|
9
|
+
CodeGenSettings: {
|
|
10
|
+
Timeout: number;
|
|
11
|
+
ValidateRequiredParameters: boolean;
|
|
12
|
+
AddSingleAuthDeprecatedCode: boolean;
|
|
13
|
+
EnableGlobalUserAgent: boolean;
|
|
14
|
+
UserAgent: string;
|
|
15
|
+
EnableLogging: boolean;
|
|
16
|
+
EnableModelKeywordArgsInRuby: boolean;
|
|
17
|
+
SymbolizeHashKeysInRuby: boolean;
|
|
18
|
+
ReturnCompleteHttpResponse: boolean;
|
|
19
|
+
UserConfigurableRetries: boolean;
|
|
20
|
+
UseEnumPrefix: boolean;
|
|
21
|
+
ExtendedAdditionalPropertiesSupport: boolean;
|
|
22
|
+
EnforceStandardizedCasing: boolean;
|
|
23
|
+
ControllerPostfix: string;
|
|
24
|
+
DoNotSplitWords: string[];
|
|
25
|
+
};
|
|
26
|
+
};
|
package/lib/config/env.js
CHANGED
|
@@ -1,4 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
export const baseURL = "https://api.apimatic.io";
|
|
2
|
+
export const metadataFileContent = {
|
|
3
|
+
ImportSettings: {
|
|
4
|
+
AutoGenerateTestCases: false,
|
|
5
|
+
ImportAdditionalHeader: false,
|
|
6
|
+
ImportAdditionalTypeCombinatorModels: false,
|
|
7
|
+
ImportTypeCombinatorsWithOnlyOneType: false
|
|
8
|
+
},
|
|
9
|
+
CodeGenSettings: {
|
|
10
|
+
Timeout: 30,
|
|
11
|
+
ValidateRequiredParameters: true,
|
|
12
|
+
AddSingleAuthDeprecatedCode: false,
|
|
13
|
+
EnableGlobalUserAgent: true,
|
|
14
|
+
UserAgent: "{language}-SDK/{version} (OS: {os-info}, Engine: {engine}/{engine-version})",
|
|
15
|
+
EnableLogging: true,
|
|
16
|
+
EnableModelKeywordArgsInRuby: true,
|
|
17
|
+
SymbolizeHashKeysInRuby: true,
|
|
18
|
+
ReturnCompleteHttpResponse: true,
|
|
19
|
+
UserConfigurableRetries: true,
|
|
20
|
+
UseEnumPrefix: false,
|
|
21
|
+
ExtendedAdditionalPropertiesSupport: true,
|
|
22
|
+
EnforceStandardizedCasing: true,
|
|
23
|
+
ControllerPostfix: "Api",
|
|
24
|
+
DoNotSplitWords: ["oauth"]
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=env.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"env.js","sourceRoot":"","sources":["../../src/config/env.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,OAAO,GAAG,yBAAyB,CAAC;AACjD,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,cAAc,EAAE;QACd,qBAAqB,EAAE,KAAK;QAC5B,sBAAsB,EAAE,KAAK;QAC7B,oCAAoC,EAAE,KAAK;QAC3C,oCAAoC,EAAE,KAAK;KAC5C;IACD,eAAe,EAAE;QACf,OAAO,EAAE,EAAE;QACX,0BAA0B,EAAE,IAAI;QAChC,2BAA2B,EAAE,KAAK;QAClC,qBAAqB,EAAE,IAAI;QAC3B,SAAS,EAAE,6EAA6E;QACxF,aAAa,EAAE,IAAI;QACnB,4BAA4B,EAAE,IAAI;QAClC,uBAAuB,EAAE,IAAI;QAC7B,0BAA0B,EAAE,IAAI;QAChC,uBAAuB,EAAE,IAAI;QAC7B,aAAa,EAAE,KAAK;QACpB,mCAAmC,EAAE,IAAI;QACzC,yBAAyB,EAAE,IAAI;QAC/B,iBAAiB,EAAE,KAAK;QACxB,eAAe,EAAE,CAAC,OAAO,CAAC;KAC3B;CACF,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DownloadTransformationParams, TransformationIdParams } from "../../types/api/transform";
|
|
1
|
+
import { DownloadTransformationParams, TransformationIdParams } from "../../types/api/transform.js";
|
|
2
2
|
import { ExportFormats, Transformation, TransformationController } from "@apimatic/sdk";
|
|
3
3
|
export declare const getTransformationId: ({ file, url, format }: TransformationIdParams, transformationController: TransformationController) => Promise<Transformation>;
|
|
4
4
|
export declare const downloadTransformationFile: ({ id, destinationFilePath, transformationController }: DownloadTransformationParams) => Promise<string>;
|
|
@@ -1,49 +1,50 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
exports.getTransformationId = async ({ file, url, format }, transformationController) => {
|
|
9
|
-
cli_ux_1.default.action.start("Transforming API specification");
|
|
1
|
+
import { ux } from "@oclif/core";
|
|
2
|
+
import fsExtra from "fs-extra";
|
|
3
|
+
import { writeFileUsingReadableStream } from "../../utils/utils.js";
|
|
4
|
+
import { TransformationFormats } from "../../types/api/transform.js";
|
|
5
|
+
import { ContentType, ExportFormats, FileWrapper } from "@apimatic/sdk";
|
|
6
|
+
export const getTransformationId = async ({ file, url, format }, transformationController) => {
|
|
7
|
+
ux.action.start("Transforming API specification");
|
|
10
8
|
let generation;
|
|
11
9
|
if (file) {
|
|
12
|
-
const fileDescriptor = new
|
|
13
|
-
generation = await transformationController.transformViaFile(fileDescriptor, format);
|
|
10
|
+
const fileDescriptor = new FileWrapper(fsExtra.createReadStream(file));
|
|
11
|
+
generation = await transformationController.transformViaFile(ContentType.EnumMultipartformdata, fileDescriptor, format);
|
|
14
12
|
}
|
|
15
13
|
else if (url) {
|
|
16
14
|
const body = {
|
|
17
15
|
url: url,
|
|
18
16
|
exportFormat: format
|
|
19
17
|
};
|
|
20
|
-
generation = await transformationController.
|
|
18
|
+
generation = await transformationController.transformViaUrl(body);
|
|
21
19
|
}
|
|
22
20
|
else {
|
|
23
21
|
throw new Error("Please provide a specification file");
|
|
24
22
|
}
|
|
25
|
-
|
|
23
|
+
ux.action.stop();
|
|
26
24
|
return generation.result;
|
|
27
25
|
};
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
export const downloadTransformationFile = async ({ id, destinationFilePath, transformationController }) => {
|
|
27
|
+
ux.action.start("Downloading Transformed file");
|
|
30
28
|
const { result } = await transformationController.downloadTransformedFile(id);
|
|
31
29
|
if (result.readable) {
|
|
32
|
-
await
|
|
30
|
+
await writeFileUsingReadableStream(result, destinationFilePath);
|
|
33
31
|
}
|
|
34
32
|
else {
|
|
35
33
|
throw new Error("Couldn't save transformation file");
|
|
36
34
|
}
|
|
37
|
-
|
|
35
|
+
ux.action.stop();
|
|
38
36
|
return destinationFilePath;
|
|
39
37
|
};
|
|
40
38
|
// Get valid platform from user's input, convert simple platform to valid Platforms enum value
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
39
|
+
export const getValidFormat = (format) => {
|
|
40
|
+
const key = Object.keys(TransformationFormats).find((value) => value === format);
|
|
41
|
+
if (key) {
|
|
42
|
+
const transformationFormat = TransformationFormats[key];
|
|
43
|
+
return ExportFormats[transformationFormat];
|
|
44
44
|
}
|
|
45
45
|
else {
|
|
46
|
-
const formats = Object.keys(
|
|
47
|
-
throw new Error(`Please provide a valid platform
|
|
46
|
+
const formats = Object.keys(TransformationFormats).join("|");
|
|
47
|
+
throw new Error(`Please provide a valid platform, e.g. ${formats}`);
|
|
48
48
|
}
|
|
49
49
|
};
|
|
50
|
+
//# sourceMappingURL=transform.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transform.js","sourceRoot":"","sources":["../../../src/controllers/api/transform.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AACjC,OAAO,OAAO,MAAM,UAAU,CAAC;AAE/B,OAAO,EAAE,4BAA4B,EAAE,MAAM,sBAAsB,CAAC;AACpE,OAAO,EAGL,qBAAqB,EAEtB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAEL,WAAW,EACX,aAAa,EACb,WAAW,EAIZ,MAAM,eAAe,CAAC;AAEvB,MAAM,CAAC,MAAM,mBAAmB,GAAG,KAAK,EACtC,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,EAA0B,EAC7C,wBAAkD,EACzB,EAAE;IAC3B,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,gCAAgC,CAAC,CAAC;IAElD,IAAI,UAAuC,CAAC;IAC5C,IAAI,IAAI,EAAE,CAAC;QACT,MAAM,cAAc,GAAG,IAAI,WAAW,CAAC,OAAO,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC;QACvE,UAAU,GAAG,MAAM,wBAAwB,CAAC,gBAAgB,CAC1D,WAAW,CAAC,qBAAqB,EACjC,cAAc,EACd,MAAuB,CACxB,CAAC;IACJ,CAAC;SAAM,IAAI,GAAG,EAAE,CAAC;QACf,MAAM,IAAI,GAA2B;YACnC,GAAG,EAAE,GAAG;YACR,YAAY,EAAE,MAAuB;SACtC,CAAC;QACF,UAAU,GAAG,MAAM,wBAAwB,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;IACpE,CAAC;SAAM,CAAC;QACN,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;IACzD,CAAC;IACD,EAAE,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;IACjB,OAAO,UAAU,CAAC,MAAM,CAAC;AAC3B,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,0BAA0B,GAAG,KAAK,EAAE,EAC/C,EAAE,EACF,mBAAmB,EACnB,wBAAwB,EACK,EAAmB,EAAE;IAClD,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,8BAA8B,CAAC,CAAC;IAEhD,MAAM,EAAE,MAAM,EAAE,GAAuB,MAAM,wBAAwB,CAAC,uBAAuB,CAAC,EAAE,CAAC,CAAC;IAElG,IAAK,MAAgC,CAAC,QAAQ,EAAE,CAAC;QAC/C,MAAM,4BAA4B,CAAC,MAA+B,EAAE,mBAAmB,CAAC,CAAC;IAC3F,CAAC;SAAM,CAAC;QACN,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAC;IACvD,CAAC;IACD,EAAE,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;IACjB,OAAO,mBAAmB,CAAC;AAC7B,CAAC,CAAC;AACF,8FAA8F;AAC9F,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,MAAc,EAAE,EAAE;IAC/C,MAAM,GAAG,GAAG,MAAM,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,KAAK,MAAM,CAElE,CAAC;IACd,IAAI,GAAG,EAAE,CAAC;QACR,MAAM,oBAAoB,GAAG,qBAAqB,CAAC,GAAG,CAA+B,CAAC;QACtF,OAAO,aAAa,CAAC,oBAAoB,CAAC,CAAC;IAC7C,CAAC;SAAM,CAAC;QACN,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAC7D,MAAM,IAAI,KAAK,CAAC,yCAAyC,OAAO,EAAE,CAAC,CAAC;IACtE,CAAC;AACH,CAAC,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
export declare const
|
|
1
|
+
import { ApiValidationExternalApisController, ApiValidationSummary } from "@apimatic/sdk";
|
|
2
|
+
import { GetValidationParams } from "../../types/api/validate.js";
|
|
3
|
+
export declare const getValidationSummary: ({ file, url }: GetValidationParams, apiValidationController: ApiValidationExternalApisController) => Promise<ApiValidationSummary>;
|
|
@@ -1,22 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
const fs = require("fs-extra");
|
|
6
|
-
const core_1 = require("@apimatic/core");
|
|
7
|
-
exports.getValidation = async ({ file, url }, apiValidationController) => {
|
|
1
|
+
import fsExtra from "fs-extra";
|
|
2
|
+
import { ContentType, FileWrapper } from "@apimatic/sdk";
|
|
3
|
+
import { createTempDirectory, deleteFile, zipDirectory } from "../../utils/utils.js";
|
|
4
|
+
export const getValidationSummary = async ({ file, url }, apiValidationController) => {
|
|
8
5
|
let validation;
|
|
9
|
-
cli_ux_1.default.action.start("Validating specification file");
|
|
10
6
|
if (file) {
|
|
11
|
-
const
|
|
12
|
-
|
|
7
|
+
const fileStatus = fsExtra.statSync(file);
|
|
8
|
+
if (fileStatus.isDirectory()) {
|
|
9
|
+
const tempDir = await createTempDirectory();
|
|
10
|
+
const zipPath = await zipDirectory(file, tempDir);
|
|
11
|
+
const zipFile = new FileWrapper(fsExtra.createReadStream(zipPath));
|
|
12
|
+
validation = await apiValidationController.validateApiViaFile(ContentType.EnumMultipartformdata, zipFile);
|
|
13
|
+
await deleteFile(zipPath);
|
|
14
|
+
await fsExtra.remove(tempDir);
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
const fileDescriptor = new FileWrapper(fsExtra.createReadStream(file));
|
|
18
|
+
validation = await apiValidationController.validateApiViaFile(ContentType.EnumMultipartformdata, fileDescriptor);
|
|
19
|
+
}
|
|
13
20
|
}
|
|
14
21
|
else if (url) {
|
|
15
|
-
validation = await apiValidationController.
|
|
22
|
+
validation = await apiValidationController.validateApiViaUrl(url);
|
|
16
23
|
}
|
|
17
24
|
else {
|
|
18
25
|
throw new Error("Please provide a specification file");
|
|
19
26
|
}
|
|
20
|
-
cli_ux_1.default.action.stop();
|
|
21
27
|
return validation.result;
|
|
22
28
|
};
|
|
29
|
+
//# sourceMappingURL=validate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate.js","sourceRoot":"","sources":["../../../src/controllers/api/validate.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,UAAU,CAAC;AAC/B,OAAO,EAA0E,WAAW,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAEjI,OAAO,EAAE,mBAAmB,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAErF,MAAM,CAAC,MAAM,oBAAoB,GAAG,KAAK,EACvC,EAAE,IAAI,EAAE,GAAG,EAAuB,EAClC,uBAA4D,EAC7B,EAAE;IACjC,IAAI,UAA6C,CAAC;IAElD,IAAI,IAAI,EAAE,CAAC;QACT,MAAM,UAAU,GAAG,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QAC1C,IAAI,UAAU,CAAC,WAAW,EAAE,EAAE,CAAC;YAC7B,MAAM,OAAO,GAAG,MAAM,mBAAmB,EAAE,CAAC;YAC5C,MAAM,OAAO,GAAG,MAAM,YAAY,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;YAClD,MAAM,OAAO,GAAG,IAAI,WAAW,CAAC,OAAO,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC,CAAC;YACnE,UAAU,GAAG,MAAM,uBAAuB,CAAC,kBAAkB,CAAC,WAAW,CAAC,qBAAqB,EAAE,OAAO,CAAC,CAAC;YAE1G,MAAM,UAAU,CAAC,OAAO,CAAC,CAAC;YAE1B,MAAM,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QAChC,CAAC;aAAM,CAAC;YACN,MAAM,cAAc,GAAG,IAAI,WAAW,CAAC,OAAO,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC;YACvE,UAAU,GAAG,MAAM,uBAAuB,CAAC,kBAAkB,CAAC,WAAW,CAAC,qBAAqB,EAAE,cAAc,CAAC,CAAC;QACnH,CAAC;IACH,CAAC;SAAM,IAAI,GAAG,EAAE,CAAC;QACf,UAAU,GAAG,MAAM,uBAAuB,CAAC,iBAAiB,CAAC,GAAG,CAAC,CAAC;IACpE,CAAC;SAAM,CAAC;QACN,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;IACzD,CAAC;IAED,OAAO,UAAU,CAAC,MAAM,CAAC;AAC3B,CAAC,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ApiValidationExternalApisController, ApiValidationSummary } from "@apimatic/sdk";
|
|
2
|
+
import { SpecFile } from "../../types/portal/quickstart.js";
|
|
3
|
+
import { PortalQuickstartPrompts } from "../../prompts/portal/quickstart.js";
|
|
4
|
+
export declare class PortalQuickstartController {
|
|
5
|
+
private readonly zipService;
|
|
6
|
+
private readonly fileService;
|
|
7
|
+
private readonly specUrl;
|
|
8
|
+
isUserAuthenticated(configDir: string): Promise<boolean>;
|
|
9
|
+
getSpecFile(spec: string): Promise<SpecFile>;
|
|
10
|
+
getSpecValidationSummary(prompts: PortalQuickstartPrompts, specFile: SpecFile, apiValidationController: ApiValidationExternalApisController): Promise<ApiValidationSummary>;
|
|
11
|
+
private downloadRepositoryFromGitHub;
|
|
12
|
+
setupBuildDirectory(prompts: PortalQuickstartPrompts, targetFolder: string, specFile: SpecFile, validationSummary: ApiValidationSummary, languages: string[]): Promise<void>;
|
|
13
|
+
}
|